Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Correct holiday test and update version #1431

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neuralprophet/forecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def add_country_holidays(
and create the corresponding configs such as lower, upper windows and the regularization
parameters

Holidays can only be added for a single country. Calling the function
Holidays can only be added for a single country or country list. Calling the function
multiple times will override already added country holidays.

Parameters
Expand Down
9 changes: 5 additions & 4 deletions neuralprophet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,13 @@ def get_holidays_from_country(country: Union[str, Iterable[str]], df=None):
if isinstance(country, str):
country = [country]

holidays = {}
unique_holidays = {}
for single_country in country:
holidays_country = get_country_holidays(single_country, years)
# only add holiday if it is not already in the dict
holidays.update(holidays_country)
holiday_names = holidays.values()
for date, name in holidays_country.items():
if date not in unique_holidays:
unique_holidays[date] = name
holiday_names = unique_holidays.values()
return set(holiday_names)


Expand Down
Loading