pandas datetime to unix timestamp seconds

后端 未结 2 1073
清歌不尽
清歌不尽 2020-12-08 16:28

From the official documentation of pandas.to_datetime we can say,

unit : string, default ‘ns’

unit of the arg (D,s,ms,us,ns)

2条回答
  •  离开以前
    2020-12-08 16:52

    In case you are accessing a particular datetime64 object from the dataframe, chances are that pandas will return a Timestamp object which is essentially how pandas stores datetime64 objects.

    You can use pd.Timestamp.to_datetime64() method of the pd.Timestamp object to convert it to numpy.datetime64 object with ns precision.

提交回复
热议问题