import pandas as pd
data = pd.read_csv('test.csv',parse_dates = ['date'])
data['date'].dt.strftime('%Y%m%d')
3. 把某一列字符串格式的时间转化为时间格式的时间:
import datetime
import pandas as pd
data = pd.DataFrame({'a':['2019-01-27 12:34:45.0','2019-01-27 11:28:32.0']})
from dateutil.parser import parse
data['timea'] = data['a'].apply(lambda x:parse(x))
timea列即为转化后的列,可以直接进行大小比较