I'd like to replace a value present in a column with by creating search string from another column
before
id address st
After
1 2.PA1234.la 1234
2 10.PA125.la 125
3 2.PA156.ln 156
id address st
I tried
1 2.PA9999.la 1234
2 10.PA9999.la 125
3 2.PA9999.ln 156
df.withColumn("address", regexp_replace("address","PA"+st,"PA9999"))
df.withColumn("address",regexp_replace("address","PA"+df.st,"PA9999")
both seam to fail with
TypeError: 'Column' object is not callable
could be similar to Pyspark replace strings in Spark dataframe column