mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-03 03:59:00 +00:00
Fix exception causes in 2 modules (#1370)
Co-authored-by: Ben Letham <bletham@gmail.com>
This commit is contained in:
parent
5842935f41
commit
952b544928
2 changed files with 6 additions and 6 deletions
|
|
@ -34,9 +34,9 @@ def get_holiday_names(country):
|
|||
except AttributeError:
|
||||
try:
|
||||
holiday_names = getattr(hdays_part1, country)(years=years).values()
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
raise AttributeError(
|
||||
"Holidays in {} are not currently supported!".format(country))
|
||||
"Holidays in {} are not currently supported!".format(country)) from e
|
||||
return set(holiday_names)
|
||||
|
||||
|
||||
|
|
@ -58,9 +58,9 @@ def make_holidays_df(year_list, country, province=None):
|
|||
except AttributeError:
|
||||
try:
|
||||
holidays = getattr(hdays_part1, country)(prov=province,years=year_list)
|
||||
except AttributeError:
|
||||
except AttributeError as e:
|
||||
raise AttributeError(
|
||||
"Holidays in {} are not currently supported!".format(country))
|
||||
"Holidays in {} are not currently supported!".format(country)) from e
|
||||
holidays_df = pd.DataFrame(list(holidays.items()), columns=['ds', 'holiday'])
|
||||
holidays_df.reset_index(inplace=True, drop=True)
|
||||
holidays_df['ds'] = pd.to_datetime(holidays_df['ds'])
|
||||
|
|
|
|||
|
|
@ -271,5 +271,5 @@ class StanBackendEnum(Enum):
|
|||
def get_backend_class(name: str) -> IStanBackend:
|
||||
try:
|
||||
return StanBackendEnum[name].value
|
||||
except KeyError:
|
||||
raise ValueError("Unknown stan backend: {}".format(name))
|
||||
except KeyError as e:
|
||||
raise ValueError("Unknown stan backend: {}".format(name)) from e
|
||||
|
|
|
|||
Loading…
Reference in a new issue