โ04-26-2022 05:15 AM
I have a task to transform a dataframe.
The task is to collect all the columns in a row and embed it into a JSON string as a column.
Source DF:
Target DF:
โ04-27-2022 12:14 AM
I was able to do this by converting df to rdd and then by applying map function to it.
rdd_1 = df.rdd.map(lambda row: (row['ID'], row.asDict() ) ) rdd_2_df = rdd_1.toDF(['ID', 'Data'])
View solution in original post
never-displayed
Passionate about hosting events and connecting people? Help us grow a vibrant local communityโsign up today to get started!