我访问同一位置的两个文件进行编译,但第一个文件正在读取,第二个文件抛出[Errno 22] Invalid参数



整个代码如下在我以前的笔记本电脑它曾经工作,因为我改变了我的笔记本电脑我得到OSError: [Errno 22]无效参数:

#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:OAReenaCOPY OF BI REPOSITORYALLOCATIONNEW 
ALLOCATION Sheet 2018.xlsx",sheet_name="based on AC DC post 2019")
Old= pd.read_excel(r"Z:OAReenaCOPY OF BI REPOSITORYALLOCATIONALL 
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")

你需要添加更多的信息:

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

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

最新更新