Zurück zu den Modellen
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.

Schnellstart

python
from sktime.transformations.holiday.financial_holidays import FinancialHolidaysTransformer

estimator = FinancialHolidaysTransformer(market, years=None, expand=True, observed=True, name=None)

Parameter(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.

Beispiele

>>> 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'

Referenzen