pyspark dataframe withColumn command not working

后端 未结 3 1013
独厮守ぢ
独厮守ぢ 2021-01-16 17:29

I have a input dataframe: df_input (updated df_input)

|comment|inp_col|inp_val|
|11     |a      |a1     |
|12     |a      |a2     |
         


        
3条回答
  •  天涯浪人
    2021-01-16 17:58

    You can simply use regex_replace like this:

    df.withColumn("new_col", regex_replace(col("inp_val"), "&", ""))
    

提交回复
热议问题