【发布时间】:2020-05-23 02:11:53
【问题描述】:
我有一个 dataframe 列,用于显示需要转换为 timestamp 的日期。目前数据如下:
6 1970/01/01 01:00:12.2739287 1970/01/01 01:00:12.4599028 1970/01/01 01:00:12.56994811 1970/01/01 01:00:14.29299213 1970/01/01 01:00:14.825224
我已经尝试了以下
st = pd.to_datetime(df['StartTime'])
timestamp = datetime.timestamp(st)
print("timestamp =", timestamp)
但收到此错误
TypeError: descriptor 'timestamp' requires a 'datetime.datetime' object but received a 'Series'
知道如何解决这个问题吗?
【问题讨论】:
-
这是干什么用的?列的 dtype 是什么?请分享minimal reproducible example。
标签: python pandas dataframe date timestamp