python实现科学计数法时间转换

直接看效果

0    1.560091e+12
1    1.560051e+12
2    1.560089e+12
3    1.560063e+12
4    1.560079e+12
5    1.560068e+12
6    1.560049e+12
7    1.560031e+12
8    1.560067e+12
9    1.560058e+12
Name: nginxtime, dtype: float64
0   2019-06-09 22:31:41.087000064
1   2019-06-09 11:25:40.123000064
2   2019-06-09 22:05:45.217999872
3   2019-06-09 14:42:19.740000000
4   2019-06-09 19:23:00.271000064
5   2019-06-09 16:06:24.368000000
6   2019-06-09 11:03:50.219000064
7   2019-06-09 05:58:15.278000128
8   2019-06-09 15:59:13.801999872
9   2019-06-09 13:21:59.166000128
Name: time, dtype: datetime64[ns]
all is well

代码如下

print(union_data['nginxtime'][0:10])
union_data['time'] = pd.to_datetime(union_data['nginxtime'] * 1e+6) + timedelta(hours=8)
print(union_data['time'][0:10])

你可能感兴趣的:(个人,python,时间转化,科学计数法)