把Python Dict类型的键值对转换成DataFrame.column
import pandas as pd
pd.set_option('display.width', 5000) # pd展示的宽度
pd.set_option('display.max_rows', None) # pd展示所有行数,不省略row
pd.set_option('display.max_columns', None) # pd展示所有列,不省略column
data_list = [
{
"author": "张三",
"biblio": {
"volume": 68,
"month": "January",
"name": "Janos Kornai",
"issue": "s",
"year": "2018",
"pages": "27-52",
"doi": ""
}
},
{
"author": "李四",
"biblio": {
"c_date": "2017",
"number": "23608",
"name": "Measuring"
}
}
]
print(pd.DataFrame(data_list))
print(pd.json_normalize(data_list))
结果.png
网友评论