Python 在dataframe中搜索要更改格式的日期单元格

Python 在dataframe中搜索要更改格式的日期单元格,python,excel,pandas,dataframe,datetime,Python,Excel,Pandas,Dataframe,Datetime,我有一些excel文件 我想更改日期的格式,但问题是并非所有的文件都具有相同的格式和模式,并且没有列的名称,因此我想在Dynamicly中搜索日期并进行更改,我知道当我知道数据的位置时该怎么做,但在我的情况下,我不知道该怎么做 file = pd.read_excel('b.xlsx') file = file.astype(str) file = file.drop(file.index[:8]) file= file.replace({'2020': '20'}, regex=True)

我有一些excel文件

我想更改日期的格式,但问题是并非所有的文件都具有相同的格式和模式,并且没有列的名称,因此我想在Dynamicly中搜索日期并进行更改,我知道当我知道数据的位置时该怎么做,但在我的情况下,我不知道该怎么做

file = pd.read_excel('b.xlsx')
file = file.astype(str)
file = file.drop(file.index[:8])

file= file.replace({'2020': '20'}, regex=True)  
file = file.iloc[:, 0]

file = pd.to_datetime(file)
file = file.dt.strftime("%m/%d/%y")