2024-10-02 08:23:09 发布
网友
我有一个.json文件,当我通过-
df = pd.read_json('tummy.json')
输出看起来像-
results 0 {u'objectId': u'06Dig7sXhU', u'SpecialProperti...' 1 {u'objectId': u'07VO1j4gVC', u'SpecialProperti...'
每一行似乎都是一本字典。我想提取每一行并从中创建一个数据帧。我真的很感激你对我的帮助
IIUC您可以使用:
import pandas as pd s = pd.Series(( {u'objectId': u'06Dig7sXhU', u'SpecialProperties': u'456456'}, {u'objectId': u'07VO1j4gVC', u'SpecialProperties': u'878421'})) df = pd.DataFrame({'results':s}) print df results 0 {u'objectId': u'06Dig7sXhU', u'SpecialProperti... 1 {u'objectId': u'07VO1j4gVC', u'SpecialProperti... print pd.DataFrame([x for x in df['results']], index=df.index) SpecialProperties objectId 0 456456 06Dig7sXhU 1 878421 07VO1j4gVC
IIUC您可以使用:
相关问题 更多 >
编程相关推荐