Skip to content

Commit

Permalink
fix: Disabling timezone of dataframe before passing Prophet (apache#1…
Browse files Browse the repository at this point in the history
…1107)

* 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
apache#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
2 people authored and auxten committed Nov 20, 2020
1 parent afb5cc1 commit 00ad751
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 00ad751

Please sign in to comment.