mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
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:
parent
ada66e30dd
commit
0bcc9d77a7
@ -599,6 +599,8 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments
|
|||||||
weekly_seasonality=weekly_seasonality,
|
weekly_seasonality=weekly_seasonality,
|
||||||
daily_seasonality=daily_seasonality,
|
daily_seasonality=daily_seasonality,
|
||||||
)
|
)
|
||||||
|
if df["ds"].dt.tz:
|
||||||
|
df["ds"] = df["ds"].dt.tz_convert(None)
|
||||||
model.fit(df)
|
model.fit(df)
|
||||||
future = model.make_future_dataframe(periods=periods, freq=freq)
|
future = model.make_future_dataframe(periods=periods, freq=freq)
|
||||||
forecast = model.predict(future)[["ds", "yhat", "yhat_lower", "yhat_upper"]]
|
forecast = model.predict(future)[["ds", "yhat", "yhat_lower", "yhat_upper"]]
|
||||||
|
Loading…
Reference in New Issue
Block a user