用pandas替换excelsh中的数据

2024-04-20 15:43:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图想出一种方法,将数据从excel文件中的工作表复制为

import pandas as pd

origionalFile = pd.ExcelFile('AnnualReport-V5.0.xlsx')
Transfers = pd.read_excel(origionalFile, 'Sheet1')

我有另一个excel文件,名为“AnnualReport-V6.0.xlsx”,它在名为“Transfers”的工作表中已有数据,我试图使用我轻松创建的数据框来替换B列中“AnnualReport-V6.0.xlsx”中的表“Transfers”中的数据,保持A列不变。在

我做了一些搜索,最接近我想要的是这个 Modifying an excel sheet in a excel book with pandas

但是它不允许我在原始表格中保留A列(A列有一些我确实想保留的方程式),有什么办法吗?谢谢


Tags: 文件数据方法importpandasreadasxlsx