将以下代码的 excel 文件从pd.read_excel()更改为pd.read_csv( ) 后,我遇到了问题。
使用 pd.read_excel() 时,没有弹出以下错误,但出于性能问题,我仍然需要使用 pd.read_csv()。
我已经尝试改变非常感谢:
t_date=pd.read_csv('D:/data.csv',encoding='utf-8',parse_dates=True)
t_date['Item Creation Date'] = t_date['Item Creation Date'].fillna('')
t_date['Item Creation Date']=pd.to_datetime(t_date['Item Creation Date'])
t_date['Order_WK']=t_date[['Item Creation Date']].apply(lambda x:(x['Item Creation Date']+relativedelta(weekday=SU)).strftime("%Y%m%d"),axis=1)
TypeError: ('can only concatenate str (not "relativedelta") to str', 'occurred at index 0')