Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.tseries.offsets.CustomBusinessHour PR02,SA01" \
-i "pandas.tseries.offsets.FY5253Quarter.is_on_offset GL08" \
-i "pandas.tseries.offsets.LastWeekOfMonth.is_on_offset GL08" \
-i "pandas.tseries.offsets.SemiMonthBegin.rule_code GL08" \
-i "pandas.tseries.offsets.SemiMonthEnd.rule_code GL08" \
-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

RET=$(($RET + $?)) ; echo $MSG "DONE"
Expand Down
24 changes: 24 additions & 0 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4516,6 +4516,30 @@ cdef class SemiMonthOffset(SingleConstructorOffset):

@property
def rule_code(self) -> str:
"""
Return a string representing the base frequency.

This returns the frequency code with the day of month suffix,
such as "SMS-15" for SemiMonthBegin or "SME-15" for SemiMonthEnd.

See Also
--------
tseries.offsets.SemiMonthBegin : Two DateOffset's per month repeating on
the first day of the month & day_of_month.
tseries.offsets.SemiMonthEnd : Two DateOffset's per month repeating on
the last day of the month & day_of_month.

Examples
--------
>>> pd.offsets.SemiMonthBegin().rule_code
'SMS-15'

>>> pd.offsets.SemiMonthEnd().rule_code
'SME-15'

>>> pd.offsets.SemiMonthBegin(day_of_month=10).rule_code
'SMS-10'
"""
suffix = f"-{self._day_of_month}"
return self._prefix + suffix

Expand Down
Loading