Skip to content

Commit

Permalink
DOC: change docstring in sync with pandas.Timestamp.to_pydatetime
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinsharma121 committed May 14, 2024
1 parent 17fb980 commit 752b36b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,30 @@ class NaTType(_NaT):
"""
Convert a Timestamp object to a native Python datetime object.
If warn=True, issue a warning if nanoseconds is nonzero.
This method is useful for when you need to utilize a pandas Timestamp
object in contexts where native Python datetime objects are expected
or required. The conversion discards the nanoseconds component, and a
warning can be issued in such cases if desired.
Parameters
----------
warn : bool, default True
If True, issues a warning when the timestamp includes nonzero
nanoseconds, as these will be discarded during the conversion.
Returns
-------
datetime.datetime or NaT
Returns a datetime.datetime object representing the timestamp,
with year, month, day, hour, minute, second, and microsecond components.
If the timestamp is NaT (Not a Time), returns NaT.
See Also
--------
datetime.datetime : The standard Python datetime class that this method
returns.
Timestamp.timestamp : Convert a Timestamp object to POSIX timestamp.
Timestamp.to_datetime64 : Convert a Timestamp object to numpy.datetime64.
Examples
--------
Expand Down

0 comments on commit 752b36b

Please sign in to comment.