dataframe 转时间戳

from datetime import datetime
# review_date 转为时间戳形式
def time2stamp(cmnttime):   #转时间戳函数
    cmnttime=datetime.strptime(cmnttime,'%Y-%m-%d %H:%M:%S')
    stamp=int(datetime.timestamp(cmnttime))
    return stamp
df_drop_m['review_date'].apply(lambda x: time2stamp(str(x)))

参考:
python快速将一个dataframe的某一列转为时间戳

猜你喜欢

转载自blog.csdn.net/Caiqiudan/article/details/111162865