Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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 @@ -106,8 +106,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timedelta.max PR02" \
-i "pandas.Timedelta.min PR02" \
-i "pandas.Timedelta.resolution PR02" \
-i "pandas.Timedelta.to_timedelta64 SA01" \
-i "pandas.Timedelta.total_seconds SA01" \
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
-i "pandas.Timestamp.max PR02" \
-i "pandas.Timestamp.min PR02" \
Expand Down
14 changes: 14 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,11 @@ cdef class _Timedelta(timedelta):
"""
Total seconds in the duration.

See Also
--------
Timedelta.seconds : Returns the seconds component of the timedelta.
Timedelta.microseconds : Returns the microseconds component of the timedelta.

Examples
--------
>>> td = pd.Timedelta('1min')
Expand Down Expand Up @@ -1403,6 +1408,14 @@ cdef class _Timedelta(timedelta):
"""
Return a numpy.timedelta64 object with 'ns' precision.

Returns
-------
numpy.timedelta64

See Also
--------
Timedelta.to_numpy : Alias method.

Examples
--------
>>> td = pd.Timedelta('3D')
Expand Down Expand Up @@ -1473,6 +1486,7 @@ cdef class _Timedelta(timedelta):

See Also
--------
Timedelta.asm8 : Return a numpy timedelta64 array scalar view.
numpy.ndarray.view : Returns a view of an array with the same data.
Timedelta.to_numpy : Converts the Timedelta to a NumPy timedelta64.
Timedelta.total_seconds : Returns the total duration of the Timedelta
Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/scalar/test_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ def test_nat_doc_strings(compare):
"Ignore differences with Timestamp.isoformat() as they're intentional"
)

if klass == Timedelta and method == "total_seconds":
pytest.skip("Ignore difference")

if method == "to_numpy":
# GH#44460 can return either dt64 or td64 depending on dtype,
# different docstring is intentional
Expand Down
Loading