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.

2
  • Does this answer your question? Pyspark replace strings in Spark dataframe column Commented Sep 17, 2020 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 Commented Sep 18, 2020 at 3:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.