Because True == True, True == False and False == False aredf.loc[:, True]df.loc[:, [col for col in df.columns if col]]# the names were strings, it would return both col
所以,为了解决这个问题,我这样做了: df['Date'] = pd.to_datetime(df.loc[df['Date'],]) 还有这个: pd.to_datetime(df.loc[df['Date/1/2020',\n...dtype='object')] are in the [index]" 我也尝试使用该列,但出现语法错误: df['Date'] = pd.to_datetime(df.loc