Skip to content

Commit 197e8db

Browse files
authoredSep 3, 2024··
Fix docstring timestamps (Issue #59458) (#59701)
add value docstring
1 parent 13578bf commit 197e8db

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
 

‎ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
131131
-i "pandas.Timestamp.nanosecond GL08" \
132132
-i "pandas.Timestamp.resolution PR02" \
133133
-i "pandas.Timestamp.tzinfo GL08" \
134-
-i "pandas.Timestamp.value GL08" \
135134
-i "pandas.Timestamp.year GL08" \
136135
-i "pandas.api.extensions.ExtensionArray.interpolate PR01,SA01" \
137136
-i "pandas.api.types.is_bool PR01,SA01" \

‎pandas/_libs/tslibs/timestamps.pyx

+23-2
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,27 @@ cdef class _Timestamp(ABCTimestamp):
240240

241241
@property
242242
def value(self) -> int:
243+
"""
244+
Return the value of the Timestamp.
245+
246+
Returns
247+
-------
248+
int
249+
The integer representation of the Timestamp object in nanoseconds
250+
since the Unix epoch (1970-01-01 00:00:00 UTC).
251+
252+
See Also
253+
--------
254+
Timestamp.second : Return the second of the Timestamp.
255+
Timestamp.minute : Return the minute of the Timestamp.
256+
257+
Examples
258+
--------
259+
>>> ts = pd.Timestamp("2024-08-31 16:16:30")
260+
>>> ts.value
261+
1725120990000000000
262+
"""
263+
243264
try:
244265
return convert_reso(self._value, self._creso, NPY_FR_ns, False)
245266
except OverflowError:
@@ -1020,8 +1041,8 @@ cdef class _Timestamp(ABCTimestamp):
10201041

10211042
See Also
10221043
--------
1023-
Timestamp.day : Return the day of the year.
1024-
Timestamp.year : Return the year of the week.
1044+
Timestamp.day : Return the day of the Timestamp.
1045+
Timestamp.year : Return the year of the Timestamp.
10251046

10261047
Examples
10271048
--------

0 commit comments

Comments
 (0)
Please sign in to comment.