Python 拟合模型时出现错误
我有一个数据框,其中有两列,即特定数字的datetime和quantity,当我试图使用fbprophet拟合模型时,我得到以下错误Python 拟合模型时出现错误,python,machine-learning,facebook-prophet,Python,Machine Learning,Facebook Prophet,我有一个数据框,其中有两列,即特定数字的datetime和quantity,当我试图使用fbprophet拟合模型时,我得到以下错误 ValueError Traceback (most recent call last) <ipython-input-72-812eb09bb3a8> in <module> 10 print(new_df) 11 m = Prophet(weekly_s
ValueError Traceback (most recent call last)
<ipython-input-72-812eb09bb3a8> in <module>
10 print(new_df)
11 m = Prophet(weekly_seasonality=True,daily_seasonality=True)
---> 12 m.fit(new_df)
13 future = m.make_future_dataframe(periods=13,freq='M')
14 forecast = m.predict(future)
~\Anaconda3\lib\site-packages\fbprophet\forecaster.py in fit(self, df, **kwargs)
1109 self.history_dates =
pd.to_datetime(pd.Series(df['ds'].unique(), name='ds')).sort_values()
1110
-> 1111 history = self.setup_dataframe(history, initialize_scales=True)
1112 self.history = history
1113 self.set_auto_seasonalities()
~\Anaconda3\lib\site-packages\fbprophet\forecaster.py in setup_dataframe(self, df, initialize_scales)
320 df['t'] = (df['ds'] - self.start) / self.t_scale
321 if 'y' in df:
--> 322 df['y_scaled'] = (df['y'] - df['floor']) / self.y_scale
323
324 for name, props in self.extra_regressors.items():
~\Anaconda3\lib\site-packages\pandas\core\ops\common.py in new_method(self, other)
62
63 other = item_from_zerodim(other)
---> 64
65 return method(self, other)
66
~\Anaconda3\lib\site-packages\pandas\core\ops\__init__.py in wrapper(left, right)
~\Anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in arithmetic_op(left, right, op, str_rep)
195 """
196 Evaluate a comparison operation `=`, `!=`, `>=`, `>`, `<=`, or `<`.
--> 197
198 Parameters
199 ----------
~\Anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in na_arithmetic_op(left, right, op, str_rep)
147 # will handle complex numbers incorrectly, see GH#32047
148 raise
--> 149 result = _masked_arith_op(left, right, op)
150
151 if is_cmp and (is_scalar(result) or result is NotImplemented):
~\Anaconda3\lib\site-packages\pandas\core\computation\expressions.py in evaluate(op, a, b, use_numexpr)
230 op_str = _op_str_mapping[op]
231 if op_str is not None:
--> 232 use_numexpr = use_numexpr and _bool_arith_check(op_str, a, b)
233 if use_numexpr:
234 # error: "None" not callable
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
请输入完整的错误回溯
from fbprophet import Prophet
m = Prophet(weekly_seasonality=True,daily_seasonality=True)
m.fit(df) # this line is showing error