0
gsh_uk_id = gsh_uk_id.withColumn("id", f.when(1, gsh_uk_id["id"].replace(".","??")).otherwise(gsh_uk_id["id"]))

it is showing error: 'Column' object is not callable

i want to replace "." character in each entry of column "id" of table gsh_uk_id with "??".

Please help me with that thankyou.

David
  • 11,245
  • 3
  • 41
  • 46
  • Does this answer your question? [Pyspark replace strings in Spark dataframe column](https://stackoverflow.com/questions/37038014/pyspark-replace-strings-in-spark-dataframe-column) – David Sep 17 '20 at 15:39
  • gsh_uk.show(5) +-------+ | id| +-------+ |ajs1q·0| |ajuy9·0| |ak57k·0| |akyri·0| |alcxf·0| +-------+ only showing top 5 rows new_gsh_uk = gsh_uk.withColumn('id', regexp_replace('id', '.', '??')) new_gsh_uk.show(5) +--------------+ | id| +--------------+ |??????????????| |??????????????| |??????????????| |??????????????| |??????????????| +--------------+ only showing top 5 rows – SHUBHAM YADAV Sep 18 '20 at 03:50

0 Answers0