From 04d3913b220425f670ccfd60db92682b79fd18e5 Mon Sep 17 00:00:00 2001 From: John Hendricks Date: Thu, 13 Mar 2025 19:14:36 -0400 Subject: [PATCH 1/2] Added docs to min/max/resolution --- pandas/_libs/tslibs/timedeltas.pyx | 74 ++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/timedeltas.pyx b/pandas/_libs/tslibs/timedeltas.pyx index 36fe29b2146b7..e4df5b5f9ea03 100644 --- a/pandas/_libs/tslibs/timedeltas.pyx +++ b/pandas/_libs/tslibs/timedeltas.pyx @@ -1033,9 +1033,77 @@ cdef class _Timedelta(timedelta): # higher than np.ndarray and np.matrix __array_priority__ = 100 - min = MinMaxReso("min") - max = MinMaxReso("max") - resolution = MinMaxReso("resolution") + + @property + def min(self): + """ + Returns the minimum bound possible for Timedelta. + + Returns the smallest possible value represented by 64 bits. + + Returns + ------- + int + + See Also + -------- + Timedelta.max: Returns the maximum bound possible for Timedelta. + Timedelta.resolution: Returns the smallest possible difference between + non-equal Timedelta objects. + + Examples + -------- + >>> pd.Timedelta.min + -9223372036854775807 + """ + return MinMaxReso("min") + + @property + def max(self): + """ + Returns the maximum bound possible for Timedelta. + + Returns the largest possible value represented by 64 bits. + + Returns + ------- + int + + See Also + -------- + Timedelta.min: Returns the minimum bound possible for Timedelta. + Timedelta.resolution: Returns the smallest possible difference between + non-equal Timedelta objects. + + Examples + -------- + >>> pd.Timedelta.max + 9223372036854775807 + """ + return MinMaxReso("max") + + @property + def resolution(self): + """ + Returns the smalleset possible difference between non-equal Timedelta objects. + + Returns the integer 1. + + Returns + ------- + int + + See Also + -------- + Timedelta.max: Returns the maximum bound possible for Timedelta. + Timedelta.min: Returns the minimum bound possible for Timedelta. + + Examples + -------- + >>> pd.Timedelta.resolution + 1 + """ + return MinMaxReso("resolution") @property def value(self): From 8860e001a30ecaf30b2f8ac297a5509ddc87ed46 Mon Sep 17 00:00:00 2001 From: John Hendricks Date: Thu, 13 Mar 2025 20:25:26 -0400 Subject: [PATCH 2/2] Removed methods from code_checks.sh --- ci/code_checks.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 6ce43725fecc9..6700a235c25be 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -72,9 +72,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \ -i "pandas.Period.freq GL08" \ -i "pandas.Period.ordinal GL08" \ - -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.resolution PR02" \