I have data frame as below first one in pyspark dataframe.
Without change to pandas Df, I need to chage the dataframe like the second one with map values.
Does anyone have an idea for this job?
a b
A 1 2
B 4 2
↓
value
A {a : 1, b : 2}
B {a : 4, b: 2}
df.to_dict()df.to_json()