Transformer
FinancialHolidaysTransformer
Financial Holidays Transformer.
This implementation wraps over holidays [1] by vacanza.
Based on the index of X, dates are extracted and passed to holidays. Then upon generating the holiday information for that day (or absence of it) based on passed financial market information, a boolean series is prepared where True indicates the date being a holiday and False otherwise. fit is a no-op for this transformer.
Quickstart
python
from sktime.transformations.holiday.financial_holidays import FinancialHolidaysTransformer
estimator = FinancialHolidaysTransformer(market, years=None, expand=True, observed=True, name=None)Tags
Capabilities
- Multivariate
- Missing values
- Unequal-length series
- Inverse transform: Not supported
- Removes missing values: Not supported
- Equalizes series length: Not supported
Properties
- Input typescitype:transform-input
- Series
- Output typescitype:transform-output
- Series
- Label typescitype:transform-labels
- None
- Fit is emptyfit_is_empty
- Yes
- Keeps the time indextransform-returns-same-time-index
- No
- Requires Xrequires_X
- Yes
- Requires yrequires_y
- No
- X and y need the same indexX-y-must-have-same-index
- No
Parameters(5)
- marketstr
An ISO 3166-1 Alpha-2 market code [2]; not implemented for all countries (see documentation [3]).
- 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.
- namestr, optional
- name of transformed series.
Examples
>>> from sktime.transformations.holiday import FinancialHolidaysTransformer
>>>
>>> import numpy
>>> data = numpy. random. default_rng (seed = 0). random (size = 365)
>>>
>>> import pandas
>>> index = pandas. date_range (start = "2023-01-01", end = "2023-12-31", freq = "D")
>>>
>>> y = pandas. Series (data, index = index, name = "random")
>>>
>>> y_t = FinancialHolidaysTransformer ("XNYS"). fit_transform (y)
>>> y_t. dtype dtype('bool')
>>> y_t. sum () 10
>>> y_t. name 'XNYS_holidays'