Return the data as an array of datetime.datetime
objects.
Deprecated since version 2.1.0: The current behavior of dt.to_pydatetime is deprecated. In a future version this will return a Series containing python datetime objects instead of a ndarray.
Timezone information is retained if present.
Warning
Pythonâs datetime uses microsecond resolution, which is lower than pandas (nanosecond). The values are truncated.
Object dtype array containing native Python datetime objects.
Examples
>>> s = pd.Series(pd.date_range('20180310', periods=2)) >>> s 0 2018-03-10 1 2018-03-11 dtype: datetime64[ns]
>>> s.dt.to_pydatetime() array([datetime.datetime(2018, 3, 10, 0, 0), datetime.datetime(2018, 3, 11, 0, 0)], dtype=object)
pandasâ nanosecond precision is truncated to microseconds.
>>> s = pd.Series(pd.date_range('20180310', periods=2, freq='ns')) >>> s 0 2018-03-10 00:00:00.000000000 1 2018-03-10 00:00:00.000000001 dtype: datetime64[ns]
>>> s.dt.to_pydatetime() array([datetime.datetime(2018, 3, 10, 0, 0), datetime.datetime(2018, 3, 10, 0, 0)], dtype=object)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4