Skip to content

Commit b759e69

Browse files
authored
DOC: Fixed all remaining GL02 documentation errors and added appropriate check in CI (#43003)
1 parent f253ce3 commit b759e69

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ fi
8989
### DOCSTRINGS ###
9090
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9191

92-
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
93-
$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
92+
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
93+
$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
9494
RET=$(($RET + $?)) ; echo $MSG "DONE"
9595

9696
fi

pandas/_libs/tslibs/nattype.pyx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,20 @@ class NaTType(_NaT):
409409
# These are the ones that can get their docstrings from datetime.
410410

411411
# nan methods
412-
weekday = _make_nan_func("weekday", datetime.weekday.__doc__)
413-
isoweekday = _make_nan_func("isoweekday", datetime.isoweekday.__doc__)
412+
weekday = _make_nan_func(
413+
"weekday",
414+
"""
415+
Return the day of the week represented by the date.
416+
Monday == 0 ... Sunday == 6.
417+
""",
418+
)
419+
isoweekday = _make_nan_func(
420+
"isoweekday",
421+
"""
422+
Return the day of the week represented by the date.
423+
Monday == 1 ... Sunday == 7.
424+
""",
425+
)
414426
total_seconds = _make_nan_func("total_seconds", timedelta.total_seconds.__doc__)
415427
month_name = _make_nan_func(
416428
"month_name",

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,6 +1960,20 @@ default 'raise'
19601960
self.nanosecond / 3600.0 / 1e+9
19611961
) / 24.0)
19621962

1963+
def isoweekday(self):
1964+
"""
1965+
Return the day of the week represented by the date.
1966+
Monday == 1 ... Sunday == 7.
1967+
"""
1968+
return super().isoweekday()
1969+
1970+
def weekday(self):
1971+
"""
1972+
Return the day of the week represented by the date.
1973+
Monday == 0 ... Sunday == 6.
1974+
"""
1975+
return super().weekday()
1976+
19631977

19641978
# Aliases
19651979
Timestamp.weekofyear = Timestamp.week

0 commit comments

Comments
 (0)