From bf8259ecc8bfd40363360545cfe0266baf64060c Mon Sep 17 00:00:00 2001 From: rmhowe425 Date: Mon, 20 Feb 2023 20:24:08 -0500 Subject: [PATCH 1/4] Updating the timedeltas.seconds docstring for Issue #50969 --- pandas/_libs/tslibs/timedeltas.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index a8c5474f0f532..2a72f7f3c1806 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1065,6 +1065,11 @@ cdef class _Timedelta(timedelta): Timedelta.seconds = hours * 3600 + minutes * 60 + seconds. + Whenever a negative timedelta is calculate, the `seconds` method is represented + as the difference of 86400 seconds (24 hours) minus the absolute value + of the calculated timedelta. To retrieve the expected output, the + `total_seconds()` method should be called instead + Returns ------- int From 5d2d5dede34dd4e0acfdc244a55ad6cfee6292cf Mon Sep 17 00:00:00 2001 From: rmhowe425 Date: Tue, 21 Feb 2023 13:21:59 -0500 Subject: [PATCH 2/4] Updating the docstring for Timedelta.seconds --- pandas/_libs/tslibs/timedeltas.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 2a72f7f3c1806..ae924b02b33a8 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1080,6 +1080,7 @@ cdef class _Timedelta(timedelta): Timedelta.components : Return all attributes with assigned values (i.e. days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds). + Timedelta.total_seconds : Express the TimeDelta as total number of seconds. Examples -------- From 53904dcae9f63861240bdafb2102b82f19957fed Mon Sep 17 00:00:00 2001 From: rmhowe425 Date: Tue, 21 Feb 2023 14:00:51 -0500 Subject: [PATCH 3/4] Removing docstrings on lines 1068-1071 as they're not needed. --- pandas/_libs/tslibs/timedeltas.pyx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index ae924b02b33a8..207b8789868d4 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1065,11 +1065,6 @@ cdef class _Timedelta(timedelta): Timedelta.seconds = hours * 3600 + minutes * 60 + seconds. - Whenever a negative timedelta is calculate, the `seconds` method is represented - as the difference of 86400 seconds (24 hours) minus the absolute value - of the calculated timedelta. To retrieve the expected output, the - `total_seconds()` method should be called instead - Returns ------- int From 644328dcea57c998951ab767903c1931c005b964 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:13:39 +0000 Subject: [PATCH 4/4] Update pandas/_libs/tslibs/timedeltas.pyx --- pandas/_libs/tslibs/timedeltas.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 207b8789868d4..2a62b3193cfab 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1075,7 +1075,7 @@ cdef class _Timedelta(timedelta): Timedelta.components : Return all attributes with assigned values (i.e. days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds). - Timedelta.total_seconds : Express the TimeDelta as total number of seconds. + Timedelta.total_seconds : Express the Timedelta as total number of seconds. Examples --------