Skip to content

DOC: Fix docstrings for Timestamp: fromordinal, fromtimestamp #59473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.date SA01" \
-i "pandas.Timestamp.day GL08" \
-i "pandas.Timestamp.fold GL08" \
-i "pandas.Timestamp.fromordinal SA01" \
-i "pandas.Timestamp.fromtimestamp PR01,SA01" \
-i "pandas.Timestamp.hour GL08" \
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.microsecond GL08" \
Expand Down
18 changes: 18 additions & 0 deletions pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,18 @@ class NaTType(_NaT):

Transform timestamp[, tz] to tz's local time from POSIX timestamp.

Parameters
----------
ts : float
The POSIX timestamp to convert.
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, default None
Time zone for time which Timestamp will be converted to.
If None, uses the system's local timezone.

See Also
--------
datetime.datetime.fromtimestamp : Standard library function to convert a timestamp to a datetime object.

Examples
--------
>>> pd.Timestamp.fromtimestamp(1584199972) # doctest: +SKIP
Expand Down Expand Up @@ -914,6 +926,12 @@ class NaTType(_NaT):
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile or None
Time zone for the Timestamp.

See Also
--------
Timestamp.fromtimestamp : Create a Timestamp from a POSIX timestamp.
Timestamp.toordinal: Return proleptic Gregorian ordinal.
datetime.datetime.fromordinal : Standard library function to convert an ordinal to a datetime.

Notes
-----
By definition there cannot be any tz info on the ordinal itself.
Expand Down
18 changes: 18 additions & 0 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,12 @@ class Timestamp(_Timestamp):
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile or None
Time zone for the Timestamp.

See Also
--------
Timestamp.fromtimestamp : Create a Timestamp from a POSIX timestamp.
Timestamp.toordinal: Return proleptic Gregorian ordinal.
datetime.datetime.fromordinal : Standard library function to convert an ordinal to a datetime.

Notes
-----
By definition there cannot be any tz info on the ordinal itself.
Expand Down Expand Up @@ -1588,6 +1594,18 @@ class Timestamp(_Timestamp):

Transform timestamp[, tz] to tz's local time from POSIX timestamp.

Parameters
----------
ts : float
The POSIX timestamp to convert.
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, default None
Time zone for time which Timestamp will be converted to.
If None, uses the system's local timezone.

See Also
--------
datetime.datetime.fromtimestamp : Standard library function to convert a timestamp to a datetime object.

Examples
--------
>>> pd.Timestamp.fromtimestamp(1584199972) # doctest: +SKIP
Expand Down