Python Pandas: 将日期列转换为UNIX时间戳
import pandas as pd from datetime import datetime
读取数据
df = pd.read_csv('data.csv')
将'createdAt'列的日期格式替换为UNIX时间戳
df['createdAt'] = pd.to_datetime(df['createdAt']).apply(lambda x: int(x.timestamp()))
打印'createdAt'列
print(df['createdAt'])
原文地址: https://www.cveoy.top/t/topic/o6vz 著作权归作者所有。请勿转载和采集!