MCPcopy
hub / github.com/pandas-dev/pandas / Holiday

Class Holiday

pandas/tseries/holiday.py:155–426  ·  view source on GitHub ↗

Class that defines a holiday with start/end dates and rules for observance.

Source from the content-addressed store, hash-verified

153
154
155class Holiday:
156 """
157 Class that defines a holiday with start/end dates and rules
158 for observance.
159 """
160
161 start_date: Timestamp | None
162 end_date: Timestamp | None
163 days_of_week: tuple[int, ...] | None
164
165 def __init__(
166 self,
167 name: str,
168 year=None,
169 month=None,
170 day=None,
171 offset: BaseOffset | list[BaseOffset] | None = None,
172 observance: Callable | None = None,
173 start_date=None,
174 end_date=None,
175 days_of_week: tuple | None = None,
176 exclude_dates: DatetimeIndex | None = None,
177 ) -> None:
178 """
179 Parameters
180 ----------
181 name : str
182 Name of the holiday , defaults to class name
183 year : int, default None
184 Year of the holiday
185 month : int, default None
186 Month of the holiday
187 day : int, default None
188 Day of the holiday
189 offset : list of pandas.tseries.offsets or
190 class from pandas.tseries.offsets, default None
191 Computes offset from date
192 observance : function, default None
193 Computes when holiday is given a pandas Timestamp
194 start_date : datetime-like, default None
195 First date the holiday is observed
196 end_date : datetime-like, default None
197 Last date the holiday is observed
198 days_of_week : tuple of int or dateutil.relativedelta weekday strs, default None
199 Provide a tuple of days e.g (0,1,2,3,) for Monday through Thursday
200 Monday=0,..,Sunday=6
201 Only instances of the holiday included in days_of_week will be computed
202 exclude_dates : DatetimeIndex or default None
203 Specific dates to exclude e.g. skipping a specific year's holiday
204
205 Examples
206 --------
207 >>> from dateutil.relativedelta import MO
208
209 >>> USMemorialDay = pd.tseries.holiday.Holiday(
210 ... "Memorial Day", month=5, day=31, offset=pd.DateOffset(weekday=MO(-1))
211 ... )
212 >>> USMemorialDay

Calls

no outgoing calls