pandas DataFrame转成字典

目录

dict形式

原数据

DateFrame.to_dict()

python 复制代码
pd.read_excel(r"D:\Users\admin\Desktop\授信额度使用.xlsx").to_dict()


list形式

DateFrame.to_dict('list')

python 复制代码
pd.read_excel(r"D:\Users\admin\Desktop\授信额度使用.xlsx").to_dict('list')

records形式

records形式是将每行转换成一个对应的字典

df.to_dict('records')

split形式

split形式比较特殊,其输出字典包含三个key值,分别为index、columns和data,分别对应行名、列名和数据。

参考文档:
https://blog.csdn.net/m0_59541412/article/details/131324515

相关推荐
云和数据.ChenGuang1 小时前
基于鲲鹏 HPC 的 AI 对话机器人架构设计与技术实现
人工智能·数据分析·机器人·pandas·数据预处理·数据训练
Cloud_Shy61810 小时前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十二章 用户定义函数 中篇)
python·数据分析·excel·pandas
沉下去,苦磨练!11 小时前
python的数据分析Pandas
python·数据分析·pandas
毋语天1 天前
Pandas 数据处理进阶:缺失值、合并、分组聚合与透视表
python·数据分析·pandas·数据清洗·透视表
hef2881 天前
探索Pandas groupby的各种技巧和应用实例
pandas
Cloud_Shy6182 天前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十二章 用户定义函数 上篇)
python·数据分析·excel·pandas
星越华夏3 天前
pandas日期类型差值timedelta大于等于7天
pandas
Omics Pro4 天前
填补蛋白质组深度学习预处理教学空白
人工智能·python·深度学习·plotly·numpy·pandas·scikit-learn
星越华夏4 天前
Pandas获取excel表sheet名称
excel·pandas
星越华夏5 天前
PPTX判断包含图表id
python·pandas