Skip to content

Commit 0eabd15

Browse files
DOC: Fix GL08 for pandas.tseries.offsets.SemiMonthBegin.rule_code
1 parent 924573a commit 0eabd15

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7474
-i "pandas.tseries.offsets.CustomBusinessHour PR02,SA01" \
7575
-i "pandas.tseries.offsets.FY5253Quarter.is_on_offset GL08" \
7676
-i "pandas.tseries.offsets.LastWeekOfMonth.is_on_offset GL08" \
77-
-i "pandas.tseries.offsets.SemiMonthBegin.rule_code GL08" \
78-
-i "pandas.tseries.offsets.SemiMonthEnd.rule_code GL08" \
7977
-i "pandas.tseries.offsets.WeekOfMonth.is_on_offset GL08" # There should be no backslash in the final line, please keep this comment in the last ignored function
8078

8179
RET=$(($RET + $?)) ; echo $MSG "DONE"

pandas/_libs/tslibs/offsets.pyx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,6 +4516,30 @@ cdef class SemiMonthOffset(SingleConstructorOffset):
45164516

45174517
@property
45184518
def rule_code(self) -> str:
4519+
"""
4520+
Return a string representing the base frequency.
4521+
4522+
This returns the frequency code with the day of month suffix,
4523+
such as "SMS-15" for SemiMonthBegin or "SME-15" for SemiMonthEnd.
4524+
4525+
See Also
4526+
--------
4527+
tseries.offsets.SemiMonthBegin : Two DateOffset's per month repeating on
4528+
the first day of the month & day_of_month.
4529+
tseries.offsets.SemiMonthEnd : Two DateOffset's per month repeating on
4530+
the last day of the month & day_of_month.
4531+
4532+
Examples
4533+
--------
4534+
>>> pd.offsets.SemiMonthBegin().rule_code
4535+
'SMS-15'
4536+
4537+
>>> pd.offsets.SemiMonthEnd().rule_code
4538+
'SME-15'
4539+
4540+
>>> pd.offsets.SemiMonthBegin(day_of_month=10).rule_code
4541+
'SMS-10'
4542+
"""
45194543
suffix = f"-{self._day_of_month}"
45204544
return self._prefix + suffix
45214545

0 commit comments

Comments
 (0)