Skip to content

Commit 8cd761a

Browse files
DOC: fix SA01,ES01 for pandas.Timedelta.view (#59733)
1 parent 38ccb33 commit 8cd761a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
113113
-i "pandas.Timedelta.resolution PR02" \
114114
-i "pandas.Timedelta.to_timedelta64 SA01" \
115115
-i "pandas.Timedelta.total_seconds SA01" \
116-
-i "pandas.Timedelta.view SA01" \
117116
-i "pandas.TimedeltaIndex.nanoseconds SA01" \
118117
-i "pandas.TimedeltaIndex.seconds SA01" \
119118
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \

pandas/_libs/tslibs/timedeltas.pyx

+15
Original file line numberDiff line numberDiff line change
@@ -1458,11 +1458,26 @@ cdef class _Timedelta(timedelta):
14581458
"""
14591459
Array view compatibility.
14601460
1461+
This method allows you to reinterpret the underlying data of a Timedelta
1462+
object as a different dtype. The `view` method provides a way to reinterpret
1463+
the internal representation of the `Timedelta` object without modifying its
1464+
data. This is particularly useful when you need to work with the underlying
1465+
data directly, such as for performance optimizations or interfacing with
1466+
low-level APIs. The returned value is typically the number of nanoseconds
1467+
since the epoch, represented as an integer or another specified dtype.
1468+
14611469
Parameters
14621470
----------
14631471
dtype : str or dtype
14641472
The dtype to view the underlying data as.
14651473
1474+
See Also
1475+
--------
1476+
numpy.ndarray.view : Returns a view of an array with the same data.
1477+
Timedelta.to_numpy : Converts the Timedelta to a NumPy timedelta64.
1478+
Timedelta.total_seconds : Returns the total duration of the Timedelta
1479+
object in seconds.
1480+
14661481
Examples
14671482
--------
14681483
>>> td = pd.Timedelta('3D')

0 commit comments

Comments
 (0)