Skip to content

Commit

Permalink
fix: Disabling timezone of dataframe before passing Prophet (#11107)
Browse files Browse the repository at this point in the history
* fix: Disabling timezone of dataframe before passing Prophet 

While running forecasting with Druid. Prophet throws the following exception. This PR removes the timezone info. 
ValueError: Column ds has timezone specified, which is not supported. Remove timezone
#11106

@villebro

* Update pandas_postprocessing.py

* Update superset/utils/pandas_postprocessing.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
  • Loading branch information
kkalyan and villebro authored Sep 30, 2020
1 parent ada66e3 commit 0bcc9d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superset/utils/pandas_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments
weekly_seasonality=weekly_seasonality,
daily_seasonality=daily_seasonality,
)
if df["ds"].dt.tz:
df["ds"] = df["ds"].dt.tz_convert(None)
model.fit(df)
future = model.make_future_dataframe(periods=periods, freq=freq)
forecast = model.predict(future)[["ds", "yhat", "yhat_lower", "yhat_upper"]]
Expand Down

0 comments on commit 0bcc9d7

Please sign in to comment.