From 5da6cb6dfab8ac0756a7ca4b9ab2906f221a6c80 Mon Sep 17 00:00:00 2001 From: elderemo Date: Sat, 10 Aug 2024 23:44:21 -0400 Subject: [PATCH 1/3] added attribute section to Timestamp docstring; added definitions of minute, month, second, and nanosecond for Timestamp attributes --- ci/code_checks.sh | 4 ---- pandas/_libs/tslibs/timestamps.pyx | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 540bd59cd5924..863651b2792ca 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -212,15 +212,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Timestamp.max PR02" \ -i "pandas.Timestamp.microsecond GL08" \ -i "pandas.Timestamp.min PR02" \ - -i "pandas.Timestamp.minute GL08" \ - -i "pandas.Timestamp.month GL08" \ -i "pandas.Timestamp.month_name SA01" \ - -i "pandas.Timestamp.nanosecond GL08" \ -i "pandas.Timestamp.normalize SA01" \ -i "pandas.Timestamp.quarter SA01" \ -i "pandas.Timestamp.replace PR07,SA01" \ -i "pandas.Timestamp.resolution PR02" \ - -i "pandas.Timestamp.second GL08" \ -i "pandas.Timestamp.strptime PR01,SA01" \ -i "pandas.Timestamp.timestamp SA01" \ -i "pandas.Timestamp.timetuple SA01" \ diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 369184d9df40c..2f54b5702cd16 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1389,6 +1389,17 @@ class Timestamp(_Timestamp): datetime-like corresponds to the first (0) or the second time (1) the wall clock hits the ambiguous time. + Attributes + ---------- + month : int + Value of month initialized by parameter of same name. + minute : int + Value of minute initialized by parameter of same name. + second : int + Value of second initialized by parameter of same name. + nanosecond : int + Value of nanosecond initialized by parameter of same name. + See Also -------- Timedelta : Represents a duration, the difference between two dates or times. From 136afb324db090480f4b1bcad6dc998917a30031 Mon Sep 17 00:00:00 2001 From: elderemo Date: Mon, 12 Aug 2024 19:21:16 -0400 Subject: [PATCH 2/3] remove the atttribute section and add the attribute definitions under 'see also' --- pandas/_libs/tslibs/timestamps.pyx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 2f54b5702cd16..e6f305fb53ee2 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1389,21 +1389,14 @@ class Timestamp(_Timestamp): datetime-like corresponds to the first (0) or the second time (1) the wall clock hits the ambiguous time. - Attributes - ---------- - month : int - Value of month initialized by parameter of same name. - minute : int - Value of minute initialized by parameter of same name. - second : int - Value of second initialized by parameter of same name. - nanosecond : int - Value of nanosecond initialized by parameter of same name. - See Also -------- Timedelta : Represents a duration, the difference between two dates or times. datetime.datetime : Python datetime.datetime object. + Timestamp.month : Returns the month value of the given Timestamp object, represented as an int. + Timestamp.minute : Returns the minute value of the given Timestamp object, represented as an int. + Timestamp.second : Returns the second value of the given Timestamp object, represented as an int. + Timestamp.nanosecond : Returns the nanosecond value of the given Timestamp object, represented as an int. Notes ----- From d7c516db3f90f4c188e1346cdf5216dd2e2ce685 Mon Sep 17 00:00:00 2001 From: elderemo Date: Mon, 12 Aug 2024 21:27:42 -0400 Subject: [PATCH 3/3] fixed attribute definition to be within width for pre-commit checks --- pandas/_libs/tslibs/timestamps.pyx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index e6f305fb53ee2..9822792865f97 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1393,10 +1393,14 @@ class Timestamp(_Timestamp): -------- Timedelta : Represents a duration, the difference between two dates or times. datetime.datetime : Python datetime.datetime object. - Timestamp.month : Returns the month value of the given Timestamp object, represented as an int. - Timestamp.minute : Returns the minute value of the given Timestamp object, represented as an int. - Timestamp.second : Returns the second value of the given Timestamp object, represented as an int. - Timestamp.nanosecond : Returns the nanosecond value of the given Timestamp object, represented as an int. + Timestamp.month : Returns the month value of the given Timestamp object. + Represented as an int. + Timestamp.minute : Returns the minute value of the given Timestamp object. + Represented as an int. + Timestamp.second : Returns the second value of the given Timestamp object. + Represented as an int. + Timestamp.nanosecond : Returns the nanosecond value of the given Timestamp object. + Represented as an int. Notes -----