You need convert strings
to dict
s by json.loads
and then call DataFrame
contructor:
df = pd.DataFrame({'a': ['{ "a" : "1", "b" : "2" }',
'{ "a" : "1", "b" : "2", "c": "3" }']})
df = pd.DataFrame(df['a'].apply(pd.io.json.loads).values.tolist())
print (df)
a b c
0 1 2 NaN
1 1 2 3
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.