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
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.
Try using json normalise:
import pandas as pd
df2 = pd.json_normalize(df['address'])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.