Skip to content

Commit 752b36b

Browse files
DOC: change docstring in sync with pandas.Timestamp.to_pydatetime
1 parent 17fb980 commit 752b36b

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

pandas/_libs/tslibs/nattype.pyx

+24-1
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,30 @@ class NaTType(_NaT):
882882
"""
883883
Convert a Timestamp object to a native Python datetime object.
884884
885-
If warn=True, issue a warning if nanoseconds is nonzero.
885+
This method is useful for when you need to utilize a pandas Timestamp
886+
object in contexts where native Python datetime objects are expected
887+
or required. The conversion discards the nanoseconds component, and a
888+
warning can be issued in such cases if desired.
889+
890+
Parameters
891+
----------
892+
warn : bool, default True
893+
If True, issues a warning when the timestamp includes nonzero
894+
nanoseconds, as these will be discarded during the conversion.
895+
896+
Returns
897+
-------
898+
datetime.datetime or NaT
899+
Returns a datetime.datetime object representing the timestamp,
900+
with year, month, day, hour, minute, second, and microsecond components.
901+
If the timestamp is NaT (Not a Time), returns NaT.
902+
903+
See Also
904+
--------
905+
datetime.datetime : The standard Python datetime class that this method
906+
returns.
907+
Timestamp.timestamp : Convert a Timestamp object to POSIX timestamp.
908+
Timestamp.to_datetime64 : Convert a Timestamp object to numpy.datetime64.
886909
887910
Examples
888911
--------

0 commit comments

Comments
 (0)