Skip to content

Commit

Permalink
Fix docstring timestamps (Issue #59458) (#59701)
Browse files Browse the repository at this point in the history
add value docstring
  • Loading branch information
mimistiv authored Sep 3, 2024
1 parent 13578bf commit 197e8db
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
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

0 comments on commit 197e8db

Please sign in to comment.