我有一本字典,正试着读/存为
pandas
数据帧。
import pandas as pd
j = {
'fields': [
{'type': 'text', 'id': 'Status'},
{'type': 'text', 'id': 'gx_location'},
{'type': 'text', 'id': 'ASSESSORS_PARCEL_NUMBER'},
{'type': 'text', 'id': 'APPLICANT'}
],
'records': [['Active',
' , ',
'0',
'1759764'],
['Active',
' , ',
'0',
'1759264'],
['Active',
'0 CHERRY AV , SAN JOSE CA 95125-0000',
'0',
'1759264']]
}
pdf = pd.DataFrame.from_dict(j, orient="index")
当我运行上面的行时,我得到了2行带索引的行
fields
和
records
.现成的
orient
选项不起作用;因为我想得到
id
从…起
领域
作为列标签和数据
记录
钥匙
Status gx_location ASSESSORS_PARCEL_NUMBER APPLICANT
Active , 0 1759764
Active , 0 1759264
Active 0 CHERRY AV... 0 1759264