Split Contents of String column in PySpark Dataframe

前端 未结 1 1736
再見小時候
再見小時候 2020-12-06 08:51

I have a pyspark data frame whih has a column containing strings. I want to split this column into words

Code:

>>> sentenceData = sqlContext         


        
相关标签:
1条回答
  • 2020-12-06 09:13

    Use split function:

    from pyspark.sql.functions import split
    
    df.withColumn("desc", split("desc", "\s+"))
    
    0 讨论(0)
提交回复
热议问题