我是新使用熊猫,我面临着一些问题,格式从系列到数据帧在jupyter。基本上我有一个这样结构的系列
0 {"province": "Paris", "city": "Paris", "countryCode": "FR", "floor": null, "country": "France", "route": "RUE MONGE", "extra": null, "coordinates": [2.35242, 48.84477], "streetNumber": "55", "locationType": null, "postalCode": "75005"} 1 {"province": null, "city": "Paris", "countryCode": "FR", "floor": "CPO_BELI_floor_1482430978123", "country": "France", "route": "PLACE DU PANTHEON", "extra": null, "coordinates": [2.345032, 48.845715], "streetNumber": "17", "locationType": "OUTDOOR", "postalCode": "75005"} 2 {"province": null, "city": "Paris", "countryCode": "FR", "floor": "CPO_BELI_floor_1482430978123", "country": "France", "route": "RUE DU BAC", "extra": null, "coordinates": [2.327753, 48.857124], "streetNumber": "35", "locationType": "OUTDOOR", "postalCode": "75007"}
我运行此代码是为了将其转换为dataframe,但id没有将序列拆分为其正确的ponding列:
pd.DataFrame(data['fields.geolocation'], index=data.index)
非常感谢你的帮助。你知道吗
很接近,需要将每行转换为
list
s:样本:
尝试将
pd.concat
与axis=1
(link)一起使用:这是您的系列:
这样就可以创建理想的数据帧
希望这有帮助。你知道吗
相关问题 更多 >
编程相关推荐