fix: Disabling timezone of dataframe before passing Prophet (#11107)

* 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
https://github.com/apache/incubator-superset/issues/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>
This commit is contained in:
Kalyan 2020-09-30 11:38:37 -07:00 committed by GitHub
parent ada66e30dd
commit 0bcc9d77a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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"]]