Making sure 'holiday' is a Dataframe when using plot_components_ploty() (#1526)

* Issue #1525: Using m.construct_holiday_dataframe() to make sure 'holidays' is a DataFrame.

* #1525 | issuecomment-639399524 | enhancement: have plotly graph the holiday component consistent with matplotlib.

Co-authored-by: Robin Teuwens <teuwens@electris.lu>
This commit is contained in:
Robin Teuwens 2020-06-11 02:33:12 +02:00 committed by GitHub
parent 9a27386ccc
commit 87844821d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -833,10 +833,10 @@ def get_forecast_component_plotly_props(m, fcst, name, uncertainty=True, plot_ca
text = None
mode = 'lines'
if name == 'holidays':
fcst = fcst[fcst[name] != 0].copy()
mode = 'markers'
# Combine holidays into one hover text
holiday_features, _, _ = m.make_holiday_features(fcst['ds'], m.holidays)
holidays = m.construct_holiday_dataframe(fcst['ds'])
holiday_features, _, _ = m.make_holiday_features(fcst['ds'], holidays)
holiday_features.columns = holiday_features.columns.str.replace('_delim_', '', regex=False)
holiday_features.columns = holiday_features.columns.str.replace('+0', '', regex=False)
text = pd.Series(data='', index=holiday_features.index)