Python 时间戳与datetime之间的转换
In [1]: import pandas as pd
In [2]: from datetime import datetime
In [3]: now = datetime.now()
In [4]: timestamp_now = now.timestamp()
In [5]: timestamp_now
Out[5]: 1566180114.256245
In [6]: pd.Timestamp.fromtimestamp(timestamp_now)
Out[6]: Timestamp('2019-08-19 10:01:54.256245')
In [7]: now
Out[7]: datetime.datetime(2019, 8, 19, 10, 1, 54, 256245)
In [8]: # use datetime
In [9]: datetime.fromtimestamp(timestamp_now)
Out[9]: datetime.datetime(2019, 8, 19, 10, 1, 54, 256245)