Snippets Collections
split_col = pyspark.sql.functions.split(df['my_str_col'], '-')
df = df.withColumn('NAME1', split_col.getItem(0))
df = df.withColumn('NAME2', split_col.getItem(1))
star

Wed Feb 24 2021 17:36:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/39235704/split-spark-dataframe-string-column-into-multiple-columns

#pyspark #spark #python #etl

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension