From d07ea959470b8585ec7948acb58506adec6974db Mon Sep 17 00:00:00 2001 From: fshi01 Date: Tue, 27 Jul 2021 10:22:33 -0400 Subject: [PATCH 1/6] Fixed GL02 Errors in Documentation --- pandas/core/groupby/generic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index 88d1baae86467..a990f800552b7 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -210,7 +210,8 @@ def _iterate_slices(self) -> Iterable[Series]: >>> s.groupby([1, 1, 2, 2]).agg(lambda x: x.astype(float).min()) 1 1.0 2 3.0 - dtype: float64""" + dtype: float64 + """ ) @Appender( @@ -957,7 +958,8 @@ class DataFrameGroupBy(GroupBy[DataFrame]): B A 1 1.0 - 2 3.0""" + 2 3.0 + """ ) @doc(_agg_template, examples=_agg_examples_doc, klass="DataFrame") From 1083eb2bdaef11b74f15deb74dd557ea906ce6ce Mon Sep 17 00:00:00 2001 From: fshi01 Date: Wed, 11 Aug 2021 17:59:51 -0400 Subject: [PATCH 2/6] DOC: Fixed remaining GL02 documentation errors --- ci/code_checks.sh | 4 ++-- pandas/_libs/tslibs/timestamps.pyx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index f9860de3b2bb3..77f206f5fc0a2 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -89,8 +89,8 @@ fi ### DOCSTRINGS ### if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then - MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG - $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03 + MSG='Validate docstrings (GL02,GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG + $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03 RET=$(($RET + $?)) ; echo $MSG "DONE" fi diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 7ed0f110f36db..4cd66751ab770 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1960,6 +1960,19 @@ default 'raise' self.nanosecond / 3600.0 / 1e+9 ) / 24.0) + def isoweekday(self): + """ + Return the day of the week represented by the date. + Monday == 1 ... Sunday == 7 + """ + return super().isoweekday() + + def weekday(self): + """ + Return the day of the week represented by the date. + Monday == 0 ... Sunday == 6 + """ + return super().weekday() # Aliases Timestamp.weekofyear = Timestamp.week From 33c35b8da07171aa348513a4a461fc413d8f1275 Mon Sep 17 00:00:00 2001 From: fshi01 Date: Wed, 11 Aug 2021 18:31:03 -0400 Subject: [PATCH 3/6] CLN: cleaning up spacing in CI for GL02 check --- ci/code_checks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 77f206f5fc0a2..7e4b5775af317 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -89,7 +89,7 @@ fi ### DOCSTRINGS ### if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then - MSG='Validate docstrings (GL02,GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG + MSG='Validate docstrings (GL02, GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS01, SS02, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA02, SA03)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=GL02,GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS02,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA02,SA03 RET=$(($RET + $?)) ; echo $MSG "DONE" From 5b511feb674151d8a25ddabfdad07fc148275222 Mon Sep 17 00:00:00 2001 From: fshi01 Date: Mon, 16 Aug 2021 11:33:17 -0400 Subject: [PATCH 4/6] DOC: Fixing pre-commit errors --- pandas/_libs/tslibs/timestamps.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index 4cd66751ab770..5a3a95384e731 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -1963,17 +1963,18 @@ default 'raise' def isoweekday(self): """ Return the day of the week represented by the date. - Monday == 1 ... Sunday == 7 + Monday == 1 ... Sunday == 7. """ return super().isoweekday() def weekday(self): """ Return the day of the week represented by the date. - Monday == 0 ... Sunday == 6 + Monday == 0 ... Sunday == 6. """ return super().weekday() + # Aliases Timestamp.weekofyear = Timestamp.week Timestamp.daysinmonth = Timestamp.days_in_month From c31a5b5a8cd2abef1920548661d7126adb95d29f Mon Sep 17 00:00:00 2001 From: fshi01 Date: Tue, 17 Aug 2021 10:47:37 -0400 Subject: [PATCH 5/6] Updating docstring in NaT to fix GL02 errors --- pandas/_libs/tslibs/nattype.pyx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index bac82b158589d..88103b5dec4f2 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -409,8 +409,20 @@ class NaTType(_NaT): # These are the ones that can get their docstrings from datetime. # nan methods - weekday = _make_nan_func("weekday", datetime.weekday.__doc__) - isoweekday = _make_nan_func("isoweekday", datetime.isoweekday.__doc__) + weekday = _make_nan_func( + "weekday", + """ + Return the day of the week represented by the date. + Monday == 1 ... Sunday == 7. + """, + ) + isoweekday = _make_nan_func( + "isoweekday", + """ + Return the day of the week represented by the date. + Monday == 0 ... Sunday == 6. + """, + ) total_seconds = _make_nan_func("total_seconds", timedelta.total_seconds.__doc__) month_name = _make_nan_func( "month_name", From 89fb670b629d042dafa3f5d297749857333e4a3b Mon Sep 17 00:00:00 2001 From: fshi01 Date: Tue, 17 Aug 2021 13:20:27 -0400 Subject: [PATCH 6/6] Updating docstring in NaT to fix GL02 errors --- pandas/_libs/tslibs/nattype.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index 88103b5dec4f2..268cdb80c22f3 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -413,14 +413,14 @@ class NaTType(_NaT): "weekday", """ Return the day of the week represented by the date. - Monday == 1 ... Sunday == 7. + Monday == 0 ... Sunday == 6. """, ) isoweekday = _make_nan_func( "isoweekday", """ Return the day of the week represented by the date. - Monday == 0 ... Sunday == 6. + Monday == 1 ... Sunday == 7. """, ) total_seconds = _make_nan_func("total_seconds", timedelta.total_seconds.__doc__)