作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有数据框和带有日期的列
date
1476329529
1476329530
1476329803
1476329805
1476329805
1476329805
我使用 df['date'] = pd.to_datetime(df.date, format='%Y-%m-%d %H:%M:%S')
转换它,但我得到了奇怪的结果
date
1970-01-01 00:00:01.476329529
1970-01-01 00:00:01.476329530
1970-01-01 00:00:01.476329803
1970-01-01 00:00:01.476329805
1970-01-01 00:00:01.476329805
1970-01-01 00:00:01.476329805
也许我做错了什么
最佳答案
这看起来像是纪元时间戳,它是自 1970 年 1 月 1 日以来的秒数:
In [71]:
pd.to_datetime(df['date'], unit='s')
Out[71]:
0 2016-10-13 03:32:09
1 2016-10-13 03:32:10
2 2016-10-13 03:36:43
3 2016-10-13 03:36:45
4 2016-10-13 03:36:45
5 2016-10-13 03:36:45
Name: date, dtype: datetime64[ns]
关于python - Pandas :时间戳到日期时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40038169/
给定一个带有多个 date_time 戳的字符串,我想 提取第一个戳及其前面的文本 候选字符串可以有一个或多个时间戳 后续的 date_time 戳记将被 sep="-" 隔开 后续date_time
是否可以合并从相机拍摄的文本和照片?我想在照片上标记日期和时间,但我在 Google 上找不到任何内容。 最佳答案 使用下面的代码来实现你所需要的。 Bitmap src = Bitm
有没有办法通过 Graph API 戳另一个用户?基于this post ,并使用 Graph Explorer ,我发布到“/USERID/pokes”,我已经授予它(Graph API 应用程序和
我有两个向左浮动的元素。一个是 body 的第一个 child ,另一个是容器的第一个 child ,容器是 body 的第二个 child 。 ...
我是一名优秀的程序员,十分优秀!