【810】pandas的DataFrame的append方法详细介绍
参考:pandas的DataFrame的append方法详细介绍
DataFrame.append(other, ignore_index=False, verify_integrity=False, sort=False)
Append rows of other to the end of caller, returning a new object.
Columns in other that are not in the caller are added as new columns.
- Parameters
-
- other: DataFrame or Series/dict-like object, or list of these
-
The data to append.
- ignore_index: bool, default False
-
If True, the resulting axis will be labeled 0, 1, …, n - 1.
- verify_integrity: bool, default False
-
If True, raise ValueError on creating index with duplicates.
- sort: bool, default False
-
Sort columns if the columns of self and other are not aligned.
Changed in version 1.0.0: Changed to not sort by default.
- Returns: DataFrame
-
-
A new DataFrame consisting of the rows of caller and the rows of other.
-
append 添加字典
import pandas as pd data = pd.DataFrame() # 生成空dataframe a = {"x":1, "y":2} # 新建字典,包含列名和数值 data = data.append(a,ignore_index=True) # 注意需要赋值操作 print(data)
显示效果:
分类:
Python Study
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2021-03-09 【530】MT | 相关 Python 技巧
2012-03-09 【018】Visual Studio 2010 调试总结
2012-03-09 【017】◀▶ C#学习(九) - ADO.NET
2012-03-09 【016】VS2010连接内置SQL数据库
2012-03-09 【015】SQL Server 2008不能连接