【发布时间】:2021-05-14 06:55:38
【问题描述】:
我有一个单列 pandas 数据框,看起来每个字典当前都是一个字符串。我想将 pandas 中的每个项目转换为字典,然后将其拆分为单独的列。
当前外观
0 {'Owl': '8109284', 'county': '27'}
1 {'Kid': '298049', 'county': '28'}
2 {'Tree': '190849', 'county': '29'}
3 {'Garden': '9801294', 'county': '30'}
4 {'House': '108094', 'county': '31'}
End Look
Item Count County County Number
0 'Owl' '8109284' 'county' '27'
1 'Kid' '298049' 'county' '28'
2 'Tree' '190849' 'county' '29'
3 'Garden' '9801294 'county' '30'
4 'House' '108094' 'county' '31'
Can anyone help resolve this. I've tried a bunch of different things.
【问题讨论】:
标签: python pandas string dataframe dictionary