Skip to content

Commit d5c50d3

Browse files
committed
DOC: use substitution decorator for business month classes (#25828)
1 parent f2bcb9f commit d5c50d3

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

pandas/tseries/offsets.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import pandas.compat as compat
1717
from pandas.compat import range
1818
from pandas.errors import AbstractMethodError
19-
from pandas.util._decorators import cache_readonly
19+
from pandas.util._decorators import Appender, Substitution, cache_readonly
2020

2121
from pandas.core.dtypes.generic import ABCPeriod
2222

@@ -972,21 +972,25 @@ class BusinessMonthBegin(MonthOffset):
972972

973973
class _CustomBusinessMonth(_CustomMixin, BusinessMixin, MonthOffset):
974974
"""
975-
DateOffset subclass representing one custom business month, incrementing
976-
between [BEGIN/END] of month dates.
975+
DateOffset subclass representing custom business month(s).
976+
977+
The count increase between %(bound)s of month dates.
977978
978979
Parameters
979980
----------
980981
n : int, default 1
982+
The number of months represented.
981983
normalize : bool, default False
982-
Normalize start/end dates to midnight before generating date range
984+
Normalize start/end dates to midnight before generating date range.
983985
weekmask : str, Default 'Mon Tue Wed Thu Fri'
984-
weekmask of valid business days, passed to ``numpy.busdaycalendar``
986+
Weekmask of valid business days, passed to ``numpy.busdaycalendar``.
985987
holidays : list
986-
list/array of dates to exclude from the set of valid business days,
987-
passed to ``numpy.busdaycalendar``
988+
List/array of dates to exclude from the set of valid business days,
989+
passed to ``numpy.busdaycalendar``.
988990
calendar : pd.HolidayCalendar or np.busdaycalendar
991+
A business day calendar.
989992
offset : timedelta, default timedelta(0)
993+
Applies an offset counted in valid days.
990994
"""
991995
_attributes = frozenset(['n', 'normalize',
992996
'weekmask', 'holidays', 'calendar', 'offset'])
@@ -1053,18 +1057,15 @@ def apply(self, other):
10531057
return result
10541058

10551059

1060+
@Substitution(bound="end")
1061+
@Appender(_CustomBusinessMonth.__doc__)
10561062
class CustomBusinessMonthEnd(_CustomBusinessMonth):
1057-
# TODO(py27): Replace condition with Subsitution after dropping Py27
1058-
if _CustomBusinessMonth.__doc__:
1059-
__doc__ = _CustomBusinessMonth.__doc__.replace('[BEGIN/END]', 'end')
10601063
_prefix = 'CBM'
10611064

10621065

1066+
@Substitution(bound="beginning")
1067+
@Appender(_CustomBusinessMonth.__doc__)
10631068
class CustomBusinessMonthBegin(_CustomBusinessMonth):
1064-
# TODO(py27): Replace condition with Subsitution after dropping Py27
1065-
if _CustomBusinessMonth.__doc__:
1066-
__doc__ = _CustomBusinessMonth.__doc__.replace('[BEGIN/END]',
1067-
'beginning')
10681069
_prefix = 'CBMS'
10691070

10701071

0 commit comments

Comments
 (0)