in trend_getter/holidays.py [0:0]
def fit(self):
for country in self.countries:
self.holiday_dfs[country] = get_calendar(
country=country,
holiday_years=self.observed_years,
exclude_paschal_cycle=self.calendar_exclude_paschal_cycle,
split_concurrent_holidays=False,
)
self.dau_dfs[country] = detrend(
df=self.df[self.df.country == country],
holiday_df=self.holiday_dfs[country],
threshold=self.detrend_threshold,
max_radius=self.detrend_max_radius,
min_radius=self.detrend_min_radius,
spike_correction=self.detrend_spike_correction,
)
self.dau_dfs[country]["dau_28ma"] = moving_average(
self.dau_dfs[country]["dau"]
)
self.dau_dfs[country]["edau_28ma"] = moving_average(
self.dau_dfs[country]["expected"]
)
self.dau_dfs[country]["dau_yoy"] = year_over_year(
self.dau_dfs[country], "dau_28ma"
)
self.dau_dfs[country]["edau_yoy"] = year_over_year(
self.dau_dfs[country], "edau_28ma"
)
self.all_countries = (
pd.concat(
[
i[["submission_date", "dau", "expected", "dau_28ma", "edau_28ma"]]
for i in self.dau_dfs.values()
]
)
.groupby("submission_date", as_index=False)
.sum(min_count=1)
)
self.all_countries["dau_yoy"] = year_over_year(self.all_countries, "dau_28ma")
self.all_countries["edau_yoy"] = year_over_year(self.all_countries, "edau_28ma")
self.holiday_impacts = estimate_impacts(
dau_dfs=self.dau_dfs,
holiday_dfs=self.holiday_dfs,
last_observed_date=self.forecast_start,
)
self.future_impacts = None