pandas.Timestamp.to_pydatetime#
- Timestamp.to_pydatetime(warn=True)#
将 Timestamp 对象转换为本地 Python datetime 对象。
如果 warn=True,则在纳秒非零时发出警告。
Examples
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548') >>> ts.to_pydatetime() datetime.datetime(2020, 3, 14, 15, 32, 52, 192548)
pd.NaT的类似用法:>>> pd.NaT.to_pydatetime() NaT