0

I have one CSV file with multiple columns, one of the columns have dictionary elements, how to expand this dictionary keys to columns

Data Frame enter image description here

Tried applying pd.Series

enter image description here

output: enter image description here

Still it's not getting split into columns.

referred this stackoverflow solution: df = pd.DataFrame({'id':[1,2,3], 'col1':[{'a':1, 'b':2, 'c':3}, {'a':3, 'b':4, 'c':5}, {'a':None, 'b':5, 'c':6}]}) df.set_index('id').col1.apply(pd.Series) working for this data frame, but not working for my original one.

1 Answers1

0

Try using json normalise:

import pandas as pd
df2 = pd.json_normalize(df['address'])