Python如何在DataFrame增加数值
作者:sym0210 时间:2021-07-23 12:56:29
这篇文章主要介绍了Python如何在DataFrame增加数值,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
生成一个 DataFrame
import pandas as pd
name = ['Cindy','John','Matt']
point = [78,87,88]
df_grade = pd.DataFrame(name, columns=['name'])
df_grade = pd.concat([df_grade, pd.DataFrame(point,columns=['point'])],axis=1)
新增一列
df_grade['gender'] = 'male'
print(df_grade)
结果
name point gender
0 Cindy 78 male
1 John 87 male
2 Matt 88 male
来源:https://www.cnblogs.com/ymsong/p/12305039.html
标签:Python,Data,Frame
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
windows下安装python的C扩展编译环境(解决Unable to find vcvarsall.bat)
2022-03-22 02:31:42
![](https://img.aspxhome.com/file/2023/2/78552_0s.png)
使用PDB简单调试Python程序简明指南
2022-07-27 21:03:28
![](https://img.aspxhome.com/file/2023/3/76163_0s.png)
Python图像处理之图片文字识别功能(OCR)
2023-10-29 17:38:00
![](https://img.aspxhome.com/file/2023/1/90501_0s.png)
Python loguru日志库之高效输出控制台日志和日志记录
2023-07-20 04:15:04
![](https://img.aspxhome.com/file/2023/2/112802_0s.png)
详解Python OpenCV图像分割算法的实现
2022-11-28 13:15:44
![](https://img.aspxhome.com/file/2023/2/78712_0s.png)
python 合并文件的具体实例
2022-03-12 03:18:26
Python SQLAlchemy库的使用方法
2021-04-19 20:16:16
Python字符串格式化输出代码实例
2021-11-09 16:44:22
关于web标准的思考
2008-10-05 10:07:00
ASP常见错误详解及解决方案小结 推荐第1/2页
2011-02-24 11:19:00
从零学Python之入门(五)缩进和选择
2022-03-04 13:11:24
在ASP中使用Oracle数据库技巧
2008-05-17 11:47:00
用Python的Django框架编写从Google Adsense中获得报表的应用
2022-10-01 13:20:07
Linux ORCLE数据库增量备份脚本
2009-11-21 09:43:00
Python绘制词云图之可视化神器pyecharts的方法
2022-12-08 14:38:44
![](https://img.aspxhome.com/file/2023/7/95417_0s.png)
WEB开发中合理选择图片格式
2011-09-22 20:32:06
Python编程之列表操作实例详解【创建、使用、更新、删除】
2021-12-24 19:03:03
![](https://img.aspxhome.com/file/2023/9/107579_0s.jpg)
在python中实现求输出1-3+5-7+9-......101的和
2022-10-08 16:33:14
用javascript实现Base64编码
2008-03-04 16:51:00
对django中foreignkey的简单使用详解
2021-09-04 21:04:20