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

相关推荐
子夜江寒1 天前
Python 学习-Day9-pandas数据导入导出操作
python·学习·pandas
咚咚王者1 天前
人工智能之数据分析 Pandas:第七章 相关性分析
人工智能·数据分析·pandas
咚咚王者1 天前
人工智能之数据分析 Pandas:第六章 数据清洗
人工智能·数据分析·pandas
Maxwell_li12 天前
Pandas 描述分析和分组分析学习文档
学习·数据分析·numpy·pandas·matplotlib
Maxwell_li12 天前
pandas数据合并
机器学习·数据分析·numpy·pandas·matplotlib
傻啦嘿哟3 天前
Pandas处理大规模数据:分块读取与内存优化实战指南
pandas
咚咚王者3 天前
人工智能之数据分析 Pandas:第五章 文件处理
人工智能·数据分析·pandas
咚咚王者3 天前
人工智能之数据分析 Pandas:第四章 常用函数
人工智能·数据分析·pandas
liuweidong08024 天前
【Pandas】pandas Rolling window sem
pandas
万粉变现经纪人4 天前
如何解决 pip install 代理报错 407 Proxy Authentication Required 问题
windows·python·pycharm·beautifulsoup·bug·pandas·pip