Pyspark: Convert column to lowercase

前端 未结 2 1616
抹茶落季
抹茶落季 2020-12-16 10:45

I want to convert the values inside a column to lowercase. Currently if I use the lower() method, it complains that column objects are not callable. Since there

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 11:23

    You can use a combination of concat_ws and split

    from pyspark.sql.functions import *
    
    df.withColumn('arr_str', lower(concat_ws('::','arr'))).withColumn('arr', split('arr_str','::')).drop('arr_str')
    

提交回复
热议问题