py pandas 处理Excel表格
2023-09-14 08:58:44 时间
import pandas as pd
class Main():
def __init__(self):
# 读取excel
self.df = pd.read_excel("C:\\Users\\ajanuw\\Desktop\\pexcel\\test.xlsx")
# 打印
print(self.df.head())
# 遍历rows
for index,row in self.df.iterrows():
print(index, row['姓名'], row['身高'])
# size
print( self.df['姓名'].size )
# 遍历columns
for name in self.df['姓名']:
print(name)
# 添加新的列
# self.df['other'] = ''
self.df['other'] = self.df['年龄'] % 2
print(self.df.head())
Main()
保存excel
import pandas as pd
class Main():
def __init__(self):
df = pd.DataFrame( [['a', 'b'],['c', 'd']],index=['row 1', 'row 2'],columns=['col 1', 'col 2'])
df.to_excel("./output.xlsx")
Main()
相关文章
- Excel操作-用excel实现爬取网站上表格数据
- Excel中线性规划求解
- 读取Excel表格日期类型数据的时候
- Office EXCEL 不用VB,你也可以制作自己的Excel菜单!
- 如何插入或 Visio 中粘贴的 Excel 工作表
- 用Python的pandas框架操作Excel文件中的数据教程
- pandas拆分指定数量的excel
- python/python读取excel
- 把数据库中的数据制作成Excel数据
- excel怎么设置密码保护?Excel文件添加密码保护教程
- Python 帮同事用pandas快速筛选Excel文件
- [转] C#操作Excel文件
- 如何将 bapi_xbp_job_spoollist_read_20 的 TABLES 参数 SPOOL_LIST 本地导出成 Excel
- C# Excel数据验重及Table数据验重
- 前端js实现打印(导出)excel表格
- 已解决ValueError: Excel file format cannot be determined, you must specify an engine manually.
- 3000字长文详解,Pandas 美化你的 Excel 表格!
- 不要逼自己学习 Excel 了,用 Python 实现 excel 的14个常用操作!
- pandas实现向已有excel中添加sheet(不覆盖)
- pandas读写excel
- 【Access2007】将Excel表导入至Access2007的当中一张已存在的表之中
- R语言批量读取写入Excel数据 r导出输出写入excel多个sheet 导出excel 导入 excel 读入excel 表格
- JAVA操作Excel表格:方法二:POI的使用①:Excel实战之POI创建excel文件(低版本)
- JAVA操作Excel表格:方法一:jxl的使用①:Excel实战之JXL创建excel文件
- 〖Python自动化办公篇⑫〗- Excel 文件自动化 - 读取 excel 数据
- SpringBoot使用Easypoi导出excel示例
- 上手Pandas,带你玩转数据(3)-- pandas数据存入文件
- 上手Pandas,带你玩转数据(2)-- 使用pandas从多种文件中读取数据