如何更换列时间名的type?

import pandas as pd
import datetime
import matplotlib.pyplot as plt

data1 = pd.read_excel('aa.xlsx', sheet_name='sheet2')
data1.drop(['A列', 'AA列'], axis=1, inplace=True) # 删除不需要的列
for i in data1.columns:
a = type(i)
a = str(a)
if a == "":
ii = datetime.datetime.strftime(i, '%Y-%m-%d')
data1.rename(columns={i: ii}, inplace=True)
print('更换完毕')

你可能感兴趣的:(如何更换列时间名的type?)