Transformer
CountryHolidaysTransformer
Country Holidays Transformer.
Quickstart
python
from sktime.transformations.holiday.country_holidays import CountryHolidaysTransformer
estimator = CountryHolidaysTransformer(country, subdiv=None, years=None, expand=True, observed=True, categories=None, name=None)Parameters(7)
- countrystr
An ISO 3166-1 Alpha-2 country code. [2]
- subdivstr, optional
The subdivision (e.g. state or province); not implemented for all countries (see documentation [3]). [2]
- yearsUnion[int, Iterable[int]], optional
- The year(s) to pre-calculate public holidays for at instantiation.
- expandbool, optional
- Whether the entire year is calculated when one date from that year is requested.
- observedbool, optional
- Whether to include the dates of when public holiday are observed (e.g. a holiday falling on a Sunday being observed the following Monday). False may not work for all countries.
- categoriesTuple[str], optional
- requested holiday categories.
- namestr, optional
- name of transformed series.
Examples
>>> from sktime.transformations.holiday import CountryHolidaysTransformer
>>>
>>> from sktime.datasets import load_airline
>>> y = load_airline ()
>>>
>>> y_t = CountryHolidaysTransformer ("US"). fit_transform (y)
>>> y_t. dtype dtype('bool')
>>> y_t. sum () 14
>>> y_t. name 'US_holidays'References
- [1 ] https://github.com/vacanza/python-holidays [2 ] (1, 2) https://www.iso.org/obp/ui/#search/code/ [3 ] https://python-holidays.readthedocs.io/en/latest/#available-countries