etna.analysis.plot_holidays#
- plot_holidays(ts: TSDataset, holidays: str | DataFrame, segments: List[str] | None = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5), start: Timestamp | int | str | None = None, end: Timestamp | int | str | None = None, as_is: bool = False)[source]#
Plot holidays for segments.
Sequence of timestamps with one holiday is drawn as a colored region. Individual holiday is drawn like a colored point.
It is not possible to distinguish points plotted at one timestamp, but this case is considered rare. This the problem isn’t relevant for region drawing because they are partially transparent.
- Parameters:
ts (TSDataset) – TSDataset with timeseries data
there are several options:
if str, then this is code of the country in holidays library;
if DataFrame and
as_is == False, then dataframe is expected to be in prophet`s holiday format;if DataFrame and
as_is == True, then dataframe is expected to be in a format with a timestamp index and holiday names columns. In a holiday column values 0 represent absence of holiday in that timestamp, 1 represent the presence.
columns_num (int) – number of columns in subplots
figsize (Tuple[int, int]) – size of the figure per subplot with one segment in inches
as_is (bool) – See
holidaysparameterstart (Timestamp | int | str | None) – start timestamp for plot
- Raises:
ValueError: – Incorrect type of
startorendis used according tots.freq.ValueError: – If
holidaysnorpd.DataFrameorstr.ValueError: – Holiday is an empty
pd.DataFrame.ValueError: – If
as_is=Truewhile holiday is string.ValueError – If
holidayisstrand data has integer timestampValueError: – If
upper_windowis negative.ValueError: – If
lower_windowis positive.