Skip to content

Commit

Permalink
chore(prophet): bump prophet to 1.0.1 (#14228)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored Apr 20, 2021
1 parent 0807ab4 commit 55bf72a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_git_sha():
"postgres": ["psycopg2-binary==2.8.5"],
"presto": ["pyhive[presto]>=0.4.0"],
"trino": ["sqlalchemy-trino>=0.2"],
"prophet": ["fbprophet>=0.7.1, <0.8", "pystan<3.0"],
"prophet": ["prophet>=1.0.1, <1.1", "pystan<3.0"],
"redshift": ["sqlalchemy-redshift>=0.8.1, < 0.9"],
"snowflake": ["snowflake-sqlalchemy>=1.2.3, <1.3"],
"teradata": ["sqlalchemy-teradata==0.9.0.dev0"],
Expand Down
6 changes: 3 additions & 3 deletions superset/utils/pandas_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,14 +631,14 @@ def _prophet_fit_and_predict( # pylint: disable=too-many-arguments
Fit a prophet model and return a DataFrame with predicted results.
"""
try:
prophet_logger = logging.getLogger("fbprophet.plot")
prophet_logger = logging.getLogger("prophet.plot")

prophet_logger.setLevel(logging.CRITICAL)
from fbprophet import Prophet # pylint: disable=import-error
from prophet import Prophet # pylint: disable=import-error

prophet_logger.setLevel(logging.NOTSET)
except ModuleNotFoundError:
raise QueryObjectValidationError(_("`fbprophet` package not installed"))
raise QueryObjectValidationError(_("`prophet` package not installed"))
model = Prophet(
interval_width=confidence_interval,
yearly_seasonality=yearly_seasonality,
Expand Down
2 changes: 1 addition & 1 deletion tests/charts/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ def test_chart_data_prophet(self):
"""
Chart data API: Ensure prophet post transformation works
"""
pytest.importorskip("fbprophet")
pytest.importorskip("prophet")
self.login(username="admin")
request_payload = get_query_context("birth_names")
time_grain = "P1Y"
Expand Down
11 changes: 10 additions & 1 deletion tests/pandas_postprocessing_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
# isort:skip_file
from datetime import datetime
from importlib.util import find_spec
import math
from typing import Any, List, Optional

Expand Down Expand Up @@ -560,7 +561,7 @@ def test_contribution(self):
self.assertListEqual(processed_df["pct_a"].tolist(), [0.25, 0.75])

def test_prophet_valid(self):
pytest.importorskip("fbprophet")
pytest.importorskip("prophet")

df = proc.prophet(
df=prophet_df, time_grain="P1M", periods=3, confidence_interval=0.9
Expand Down Expand Up @@ -588,6 +589,14 @@ def test_prophet_valid(self):
assert df[DTTM_ALIAS].iloc[-1].to_pydatetime() == datetime(2022, 5, 31)
assert len(df) == 9

def test_prophet_import(self):
prophet = find_spec("prophet")
if prophet is None:
with pytest.raises(QueryObjectValidationError):
proc.prophet(
df=prophet_df, time_grain="P1M", periods=3, confidence_interval=0.9
)

def test_prophet_missing_temporal_column(self):
df = prophet_df.drop(DTTM_ALIAS, axis=1)

Expand Down

0 comments on commit 55bf72a

Please sign in to comment.