Skip to content

Fix docstring timestamps (Issue #59458) #59701

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

Merged
Merged
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
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.nanosecond GL08" \
-i "pandas.Timestamp.resolution PR02" \
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.value GL08" \
-i "pandas.Timestamp.year GL08" \
-i "pandas.api.extensions.ExtensionArray.interpolate PR01,SA01" \
-i "pandas.api.types.is_bool PR01,SA01" \
Expand Down
25 changes: 23 additions & 2 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,27 @@ cdef class _Timestamp(ABCTimestamp):

@property
def value(self) -> int:
"""
Return the value of the Timestamp.

Returns
-------
int
The integer representation of the Timestamp object in nanoseconds
since the Unix epoch (1970-01-01 00:00:00 UTC).

See Also
--------
Timestamp.second : Return the second of the Timestamp.
Timestamp.minute : Return the minute of the Timestamp.

Examples
--------
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
>>> ts.value
1725120990000000000
"""

try:
return convert_reso(self._value, self._creso, NPY_FR_ns, False)
except OverflowError:
Expand Down Expand Up @@ -1020,8 +1041,8 @@ cdef class _Timestamp(ABCTimestamp):

See Also
--------
Timestamp.day : Return the day of the year.
Timestamp.year : Return the year of the week.
Timestamp.day : Return the day of the Timestamp.
Timestamp.year : Return the year of the Timestamp.

Examples
--------
Expand Down