字符串转化为13位时间戳
import datetime
def str_to_int13(t):
int_t13 = datetime.datetime.strptime(str(t),"%Y-%m-%d %H:%M:%S")
return int(int_t13.timestamp() * 1000)
# pandas将某一列str时间转化为13位时间戳
df_need['time'] = df_need['time'].map(str_to_int13)
#将10位时间戳转换为时间字符串,默认为2017-10-01 13:37:04格式
def timestamp_to_date(time_stamp, format_string="%Y-%m-%d %H:%M:%S"):
time_array = time.localtime(time_stamp)
str_date = time.strftime(format_string, time_array)
13位时间戳转化为字符串
df_['time_list'] = pd.to_datetime(df_['time_list'],unit='ms')