import polars as pl
import pytimetk as tk
tk.is_holiday('2023-01-01', country_name='UnitedStates')0 True
Name: is_holiday, dtype: bool
Check if a given list of dates are holidays for a specified country.
Note: This function requires the holidays package to be installed.
| Name | Type | Description | Default |
|---|---|---|---|
| idx | Union[str, datetime, List[Union[str, datetime]], pd.Series] | The dates to check for holiday status. | required |
| country_name | str | The name of the country for which to check the holiday status. Defaults to ‘UnitedStates’ if not specified. | 'UnitedStates' |
| country | str | An alternative parameter to specify the country for holiday checking, overriding country_name. | None |
| engine | str | The engine parameter is used to specify the engine to use for generating the boolean series. It can be either “pandas” or “polars”. - The default value is “pandas”. - When “polars”, the function will internally use the polars library for generating a boolean of holidays or not holidays. This can be faster than using “pandas” for long series. |
'pandas' |
pd.Series: Series containing True if the date is a holiday, False otherwise.
ValueError: If the specified country is not found in the holidays package.
0 True
Name: is_holiday, dtype: bool