From 4393a483d3050e6e8c3414db9bcf95f29173316c Mon Sep 17 00:00:00 2001 From: ammar-qazi Date: Thu, 5 Sep 2024 21:19:27 +0200 Subject: [PATCH 1/2] Add documentation for min, max, and resolution attributes of Timedelta --- pandas/_libs/tslibs/timedeltas.pyx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 4f90f26cf31ab..c7742a2a43d24 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1857,6 +1857,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 fa1f22f6a15fde9cda3fed030034d14a0042b2d4 Mon Sep 17 00:00:00 2001 From: ammar-qazi Date: Thu, 5 Sep 2024 21:20:46 +0200 Subject: [PATCH 2/2] Fixed issues after the review. --- ci/code_checks.sh | 3 --- pandas/_libs/tslibs/timedeltas.pyx | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 2aa256b65a493..bfd31cb52cd4d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -104,9 +104,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.sparse.npoints SA01" \ -i "pandas.Series.sparse.sp_values SA01" \ -i "pandas.Timedelta.components SA01" \ - -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" \ diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index c7742a2a43d24..86627e71371c9 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1857,11 +1857,11 @@ class Timedelta(_Timedelta): Values for construction in compat with datetime.timedelta. Numpy ints and floats will be coerced to python ints and floats. - **Attributes - -------- + Attributes + ---------- resolution: Timedelta - Represents the smallest difference between two time units that can be represented - by the Timedelta object. + 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