prophet uses deprecated numpy np.float/int aliases
Running the basic car sales example
from pandas import read_csv
from pandas import to_datetime
from fbprophet import Prophet
# load data
path = 'https://raw.githubusercontent.com/jbrownlee/Datasets/master/monthly-car-sales.csv'
df = read_csv(path, header=0)
# prepare expected column names
df.columns = ['ds', 'y']
df['ds']= to_datetime(df['ds'])
# define the model
model = Prophet()
# fit the model
model.fit(df)
fails against my python-numpy 1.26.4 (that's far before 2.0!) with:
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/site-packages/fbprophet/forecaster.py", line 1115, in fit
self.make_all_seasonality_features(history))
File "/usr/lib/python3.10/site-packages/fbprophet/forecaster.py", line 765, in make_all_seasonality_features
features = self.make_seasonality_features(
File "/usr/lib/python3.10/site-packages/fbprophet/forecaster.py", line 458, in make_seasonality_features
features = cls.fourier_series(dates, period, series_order)
File "/usr/lib/python3.10/site-packages/fbprophet/forecaster.py", line 434, in fourier_series
.astype(np.float)
File "/usr/lib/python3.10/site-packages/numpy/__init__.py", line 324, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
also
File "/usr/lib/python3.10/site-packages/fbprophet/forecaster.py", line 401, in set_changepoints
.astype(np.int)
AttributeError: module 'numpy' has no attribute 'int'.
This may be fixed by changing them into float64/int64.
see also https://github.com/facebook/prophet/issues/2404
same issue
import pandas as pd from prophet import Prophet from matplotlib import pyplot
class FrcstSucs(object):
def __init__(self):
pass
def frcst_efe_suc(self, dfdata):
dfdata.plot()
model = Prophet()
model.fit(dfdata)
dftestdates = pd.DataFrame({'ds': pd.date_range(start='10/1/2023', periods=61, freq='D')})
dftest = model.predict(dftestdates)
print(dftest[['ds', 'yhat', 'yhat_lower', 'yhat_upper']])
model.plot(dftest)
pyplot.show()
from prophet import Prophet
File "C:\Python\Python312\Lib\site-packages\prophet_init_.py", line 7, in np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead.. Did you mean: 'float16'?
Fixed in https://github.com/facebook/prophet/pull/2592