PublicHolidaysOffline class

Definition

Public holiday class.

PublicHolidaysOffline(country_or_region: str = 'US', start_date: datetime.datetime = datetime.datetime(1970, 1, 1, 0, 0), end_date: datetime.datetime = datetime.datetime(2099, 1, 1, 0, 0), cols: typing.Union[typing.List[str], NoneType] = None, enable_telemetry: bool = True)
Inheritance

Methods

get_holidays_dates(country_code: typing.Union[str, NoneType] = None, country_or_region: typing.Union[str, NoneType] = None) -> typing.Union[typing.Dict[datetime.datetime, NoneType], NoneType]

Get a Dict with Key of the dates of holidays.

get_holidays_in_range(start_date: datetime.date, end_date: datetime.date, country_code: str = 'US') -> pandas.core.frame.DataFrame

Get a list of holiday infomation base on the given date range.

get_holidays_in_range_by_country_or_region(start_date: datetime.date, end_date: datetime.date, country_or_region: str = 'United States') -> pandas.core.frame.DataFrame

Get a list of holiday infomation base on the given date range.

get_pandas_limit()

Get instance of pandas data load limit class.

is_holiday(target_date: datetime.date, country_code: str = 'US') -> bool

Detect a date is a holiday or not.

is_holiday_by_country_or_region(target_date: datetime.date, country_or_region: str = 'United States') -> bool

Detect a date is a holiday or not.

get_holidays_dates(country_code: typing.Union[str, NoneType] = None, country_or_region: typing.Union[str, NoneType] = None) -> typing.Union[typing.Dict[datetime.datetime, NoneType], NoneType]

Get a Dict with Key of the dates of holidays.

get_holidays_dates(country_code: typing.Union[str, NoneType] = None, country_or_region: typing.Union[str, NoneType] = None) -> typing.Union[typing.Dict[datetime.datetime, NoneType], NoneType]

Parameters

country_code

Indicate which country/region's holiday infomation will be used for the check.

Returns

The dict with dates of holidays as the keys and None as values.

get_holidays_in_range(start_date: datetime.date, end_date: datetime.date, country_code: str = 'US') -> pandas.core.frame.DataFrame

Get a list of holiday infomation base on the given date range.

get_holidays_in_range(start_date: datetime.date, end_date: datetime.date, country_code: str = 'US') -> pandas.core.frame.DataFrame

Parameters

start_date

The start date of the date range.

end_date

The end date of the date range.

country_code

Indicate which country/region's holiday infomation will be used for the check.

Returns

A DataFrame which contains the holidays in the target date range.

get_holidays_in_range_by_country_or_region(start_date: datetime.date, end_date: datetime.date, country_or_region: str = 'United States') -> pandas.core.frame.DataFrame

Get a list of holiday infomation base on the given date range.

get_holidays_in_range_by_country_or_region(start_date: datetime.date, end_date: datetime.date, country_or_region: str = 'United States') -> pandas.core.frame.DataFrame

Parameters

start_date

The start date of the date range.

end_date

The end date of the date range.

country_or_region

Indicate which country/region's holiday infomation will be used for the check.

Returns

A DataFrame which contains the holidays in the target date range.

get_pandas_limit()

Get instance of pandas data load limit class.

get_pandas_limit()

is_holiday(target_date: datetime.date, country_code: str = 'US') -> bool

Detect a date is a holiday or not.

is_holiday(target_date: datetime.date, country_code: str = 'US') -> bool

Parameters

target_date

The date which needs to be check.

country_code

Indicate which country/region's holiday infomation will be used for the check.

Returns

Whether the target_date is a holiday or not. True or False.

is_holiday_by_country_or_region(target_date: datetime.date, country_or_region: str = 'United States') -> bool

Detect a date is a holiday or not.

is_holiday_by_country_or_region(target_date: datetime.date, country_or_region: str = 'United States') -> bool

Parameters

target_date

The date which needs to be check.

country_or_region

Indicate which country/region's holiday infomation will be used for the check.

Returns

Whether the target_date is a holiday or not. True or False.

Attributes

HOLIDAYS_DF

HOLIDAYS_DF =          countryOrRegion      ...      isPaidTimeOff 0                Denmark      ...               None 1                Belgium      ...               None 2            Netherlands      ...               None 3                Croatia      ...               None 4                  Czech      ...               None 5                 Poland      ...               None 6            New Zealand      ...               None 7                 Sweden      ...               None 8                 Brazil      ...               None 9                 Canada      ...               None 10              Portugal      ...               None 11             Australia      ...               None 12               Finland      ...               None 13                 Italy      ...               None 14          South Africa      ...               None 15                 Spain      ...               None 16              Colombia      ...               None 17             Argentina      ...               None 18                 India      ...              False 19           Switzerland      ...               None 20                Norway      ...               None 21               Austria      ...               None 22                France      ...               None 23                 Japan      ...               None 24               Ukraine      ...               None 25               Hungary      ...               None 26                Mexico      ...               None 27         United States      ...               True 28              Scotland      ...               None 29           Switzerland      ...               None ...                  ...      ...                ... 344956           Belgium      ...               None 344957      South Africa      ...               None 344958            Sweden      ...               None 344959             Italy      ...               None 344960           Denmark      ...               None 344961          Slovenia      ...               None 344962           Germany      ...               None 344963      South Africa      ...               None 344964             Czech      ...               None 344965    United Kingdom      ...               True 344966           Austria      ...               None 344967            Norway      ...               None 344968       New Zealand      ...               None 344969            Poland      ...               None 344970  Northern Ireland      ...               None 344971          Scotland      ...               None 344972         Australia      ...               None 344973       Isle of Man      ...               None 344974           Ireland      ...               None 344975             Wales      ...               None 344976           England      ...               None 344977           Finland      ...               None 344978       Netherlands      ...               None 344979           Hungary      ...               None 344980            Canada      ...               None 344981           Croatia      ...               None 344982            Norway      ...               None 344983            Sweden      ...               None 344984            Sweden      ...               None 344985            Norway      ...               None  [344986 rows x 5 columns]

data

data = None

default_country_or_region

default_country_or_region = 'US'

default_end_date

default_end_date = datetime.datetime(2099, 1, 1, 0, 0)

default_start_date

default_start_date = datetime.datetime(1970, 1, 1, 0, 0)