假设df看起来像
print(df) date_col0 2018-07-25 11:14:001 2018-08-26 11:15:002 2018-07-29 11:17:00#convert from string to datetimedf['date_col'] = pd.to_datetime(df['date_col'])#to get date onlyprint(df['date_col'].dt.date)0 2018-07-251 2018-08-262 2018-07-29#to get time:print(df['date_col'].dt.time)0 11:14:001 11:15:002 11:17:00#to get hour and minuteprint(df['date_col'].dt.strftime('%H:%M'))0 11:141 11:152 11:17


