From c4eab08fb82d11ce6ccd2b54c09e03a24da6925b Mon Sep 17 00:00:00 2001 From: Ammar Qazi Date: Sun, 3 Nov 2024 00:26:55 +0100 Subject: [PATCH 1/2] Fix min, max, resolution of Timedelta --- ci/code_checks.sh | 3 --- pandas/_libs/tslibs/timedeltas.pyx | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index adcf48507698b..225c846bed1a9 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -76,9 +76,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.dt.freq GL08" \ -i "pandas.Series.dt.unit GL08" \ -i "pandas.Series.pad PR01,SA01" \ - -i "pandas.Timedelta.max PR02" \ - -i "pandas.Timedelta.min PR02" \ - -i "pandas.Timedelta.resolution PR02" \ -i "pandas.Timestamp.max PR02" \ -i "pandas.Timestamp.min PR02" \ -i "pandas.Timestamp.nanosecond GL08" \ diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 15b629624bafc..6466f03a26c8e 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1893,6 +1893,21 @@ class Timedelta(_Timedelta): Values for construction in compat with datetime.timedelta. Numpy ints and floats will be coerced to python ints and floats. + Attributes + ---------- + resolution: Timedelta + Represents the smallest difference between two time units that can be + represented by the Timedelta object. + Fixed at 0 days 00:00:00.000000001 (1 nanosecond). + min : Timedelta + Returns the minimum Timedelta value that can be created or used in + pandas operations. + Fixed at -106752 days +00:12:43.145224193 + max : Timedelta + Returns the maximum Timedelta value that can be created or used in + pandas operations. + Fixed at 106751 days 23:47:16.854775807. + See Also -------- Timestamp : Represents a single timestamp in time. From 8487091ab33e80daebb16847b7d4fa7798322e1b Mon Sep 17 00:00:00 2001 From: Ravenin7 Date: Tue, 12 Nov 2024 15:39:52 +0530 Subject: [PATCH 2/2] made requested changes to remove example and fix typo --- pandas/_libs/tslibs/timedeltas.pyx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 6466f03a26c8e..90aca9ce5e4f6 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1895,18 +1895,15 @@ class Timedelta(_Timedelta): Attributes ---------- - resolution: Timedelta + resolution : Timedelta Represents the smallest difference between two time units that can be represented by the Timedelta object. - Fixed at 0 days 00:00:00.000000001 (1 nanosecond). min : Timedelta Returns the minimum Timedelta value that can be created or used in pandas operations. - Fixed at -106752 days +00:12:43.145224193 max : Timedelta Returns the maximum Timedelta value that can be created or used in pandas operations. - Fixed at 106751 days 23:47:16.854775807. See Also --------