相关疑难解决方法(0)

将字典列表转换为pandas DataFrame

我有一个这样的词典列表:

[{'points': 50, 'time': '5:00', 'year': 2010}, 
{'points': 25, 'time': '6:00', 'month': "february"}, 
{'points':90, 'time': '9:00', 'month': 'january'}, 
{'points_h1':20, 'month': 'june'}]
Run Code Online (Sandbox Code Playgroud)

我想把它变成DataFrame像这样的熊猫:

      month  points  points_h1  time  year
0       NaN      50        NaN  5:00  2010
1  february      25        NaN  6:00   NaN
2   january      90        NaN  9:00   NaN
3      june     NaN         20   NaN   NaN
Run Code Online (Sandbox Code Playgroud)

注意:列的顺序无关紧要.

如何将字典列表转换为pandas DataFrame,如上所示?

python dictionary dataframe pandas

550
推荐指数
4
解决办法
25万
查看次数

标签 统计

dataframe ×1

dictionary ×1

pandas ×1

python ×1