-1

整个代码在我以前的笔记本电脑中使用,因为我更换了笔记本电脑,我得到了 OSError: [Errno 22] Invalid argument:

#Combine both allocation sheets from shared drive
import pandas as pd
import numpy as np
from datetime import date
import xgboost as xgb

print("Reading Both Files")

New= pd.read_excel(r"Z:\OA\Reena\COPY OF BI REPOSITORY\ALLOCATION\NEW 
ALLOCATION Sheet 2018.xlsx",sheet_name="based on AC DC post 2019")
Old= pd.read_excel(r"Z:\OA\Reena\COPY OF BI REPOSITORY\ALLOCATION\ALL 
OLD ACCOUNTS.xlsx",sheet_name="Based of acntDC til2018")



print("Reading Both Files Completed")

Allocation = [New,Old]



Allocation = pd.concat(Allocation)



Allocation['Alexa Rank - Global'].fillna('N/A', inplace=True)
Allocation['Alexa Country Rank'].fillna('N/A', inplace=True)
Allocation['Publisher'].fillna('NA', inplace=True)

                                        
Allocation.to_excel("Allocation_Dump.xlsx",index = False)

print("Allocation_Dump good to use")
4

1 回答 1

0

您需要添加更多信息:

  • 其余代码是什么样的
  • 您是否尝试过相互切换文件
  • 是否有任何其他进程锁定其中一个文件(例如 Excel)
  • 是否正在读取第三个 excel 文件
  • 等等等等

你需要给我们更多的帮助来帮助你。

于 2021-09-30T07:47:41.850 回答