http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.from_dict.html

Examples

By default the keys of the dict become the DataFrame columns:

>>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data)
col_1 col_2
0 3 a
1 2 b
2 1 c
3 0 d

Specify orient='index' to create the DataFrame using dictionary keys as rows:

>>> data = {'row_1': [3, 2, 1, 0], 'row_2': ['a', 'b', 'c', 'd']}
>>> pd.DataFrame.from_dict(data, orient='index')
0 1 2 3
row_1 3 2 1 0
row_2 a b c d

When using the ‘index’ orientation, the column names can be specified manually:

>>> pd.DataFrame.from_dict(data, orient='index',
... columns=['A', 'B', 'C', 'D'])
A B C D
row_1 3 2 1 0
row_2 a b c d

最新文章

  1. windows环境下sublime的nodejs插件详细安装图解
  2. .NET跨平台之旅:将示例站点升级至 .NET Core 1.1 Preview 1
  3. 实战 ASP.NET Web API
  4. UITextView回收或关闭键盘
  5. asp.net WebApi and protobuff
  6. html元素elem.style.top.left始终为空
  7. BYTE、WORD与DWORD类型
  8. SMTP ERROR: Password command failed: 535 Incorrect authentication data
  9. python学习之路-4 内置函数和装饰器
  10. HDU 3362 Fix
  11. Hidden String(深搜)
  12. octet-stream
  13. Ghost文件封装说明
  14. Css3关键帧动画
  15. Colored Sticks POJ - 2513 并查集+欧拉通路+字典树hash
  16. QML学习笔记(四)-TabView-竖直方向
  17. Java知多少(13)流程控制
  18. Oracle 11g:bin目录下3个特效权限的文件:root用户所有者 + s权限
  19. poj 2777 线段树的区间更新
  20. Oracle 12c新特性(For DBA)

热门文章

  1. NOIP 2018 划水记
  2. HTML 转 PDF的两种实现方式
  3. POJ1192最优连通子串----树形dp
  4. MySql中not in的优化
  5. Scss 与 Sass 是什么,他们的区别在哪里?
  6. (简单)华为P9plus VIE-AL00的usb调试模式在哪里开启的经验
  7. gdb 命令汇总
  8. WARING
  9. 20165309 《网络对抗技术》 Kali安装
  10. python-json函数