import pandas as pd
import pystan
from fbprophet import Prophet
plt.style.use('fivethirtyeight')
y = [t1_tmax['date'], t1_tmax['value']]
import pandas as pd
df = pd.DataFrame({'date': y[0], 'value': y[1]})
df.dtypes
df = df.rename(columns={'date': 'ds','value': 'y'})
df
my_model = Prophet(interval_width=0.95)
my_model.fit(df)
I have installed the latest Pystan and fbprophet versions:
pystan 2.17.1.0
fbprophet 0.4.post2
Currently, I'm using conda 4.6.14 with Python 3.6.7 version as suggested after uninstalling 3.7 in other threads!
my_model.fit(df)
``
Exception Traceback (most recent call last)
2 #with weekly_seasonality=True
3 #instantiate Prophet
----> 4 my_model.fit(df) #fit the model with your dataframe
~\Anaconda3\Anaconda\lib\site-packages\fbprophet\forecaster.py in fit(self, df, **kwargs)
1010 """
1011 if self.history is not None:
-> 1012 raise Exception('Prophet object can only be fit once. '
1013 'Instantiate a new object.')
1014 if ('ds' not in df) or ('y' not in df):
Exception: Prophet object can only be fit once. Instantiate a new object.
not clear this is a pandas issue
too many other packages are used
Got this same error after updating pandas package
TypeError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _repr_html_(self)
694 See Also
695 --------
--> 696 to_html : Convert DataFrame to HTML.
697
698 Examples
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in to_html(self, buf, columns, col_space, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, bold_rows, classes, escape, max_rows, max_cols, show_dimensions, notebook, decimal, border, table_id)
2035 Dictionary mapping columns containing datetime types to stata
2036 internal format to use when writing the dates. Options are 'tc',
-> 2037 'td', 'tm', 'tw', 'th', 'tq', 'ty'. Column can be either an integer
2038 or a name. Datetime columns that do not have a conversion type
2039 specified will be converted to 'tc'. Raises NotImplementedError if
C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\formats\format.py in to_html(self, classes, notebook, border)
751 need_leadsp = dict(zip(fmt_columns, map(is_numeric_dtype, dtypes)))
752
--> 753 def space_format(x, y):
754 if (y not in self.formatters and
755 need_leadsp[x] and not restrict_formatting):
TypeError: __init__() got an unexpected keyword argument 'max_rows'
Was having the same error. Updating to pandas 0.25.0 and restarting the jupyter kernel seemed to solve the problem.
Most helpful comment
Was having the same error. Updating to pandas 0.25.0 and restarting the jupyter kernel seemed to solve the problem.