用pandas读入文件,时间格式是CST 想转为标准的年月日格式
代码:
def cst_to_str(cstTime):
tempTime = time.strptime(cstTime,'%a %b %d %H:%M:%S CST %Y')
resTime = time.strftime('%Y-%m-%d',tempTime)
return resTime
df_info['adddate'] = df_info['adddate'].apply(cst_to_str )
原来的格式如下:
经过转换处理后: