Francisco
10/10/2023, 8:32 PM---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[42], line 2
1 #Visualizar Pronosticos al asar
----> 2 sf.plot(train_agg,forecasts_df)
File ~\.conda\envs\Merck\lib\site-packages\statsforecast\core.py:1740, in _StatsForecast.plot(df, forecasts_df, unique_ids, plot_random, models, level, max_insample_length, plot_anomalies, engine, resampler_kwargs)
1738 ds = train_uid["ds"]
1739 y = train_uid["y"]
-> 1740 axes[idx, idy].plot(ds, y, label="y")
1741 if forecasts_df is not None:
1742 if models is None:
File ~\.conda\envs\Merck\lib\site-packages\matplotlib\axes\_axes.py:1605, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
1363 """
1364 Plot y versus x as lines and/or markers.
1365
(...)
1602 (``'green'``) or hex strings (``'#008000'``).
1603 """
1604 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1605 lines = [*self._get_lines(*args, data=data, **kwargs)]
1606 for line in lines:
1607 self.add_line(line)
File ~\.conda\envs\Merck\lib\site-packages\matplotlib\axes\_base.py:315, in _process_plot_var_args.__call__(self, data, *args, **kwargs)
313 this += args[0],
314 args = args[1:]
--> 315 yield from self._plot_args(this, kwargs)
File ~\.conda\envs\Merck\lib\site-packages\matplotlib\axes\_base.py:490, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs)
487 kw[prop_name] = val
489 if len(xy) == 2:
--> 490 x = _check_1d(xy[0])
491 y = _check_1d(xy[1])
492 else:
File ~\.conda\envs\Merck\lib\site-packages\matplotlib\cbook\__init__.py:1362, in _check_1d(x)
1356 with warnings.catch_warnings(record=True) as w:
1357 warnings.filterwarnings(
1358 "always",
1359 category=Warning,
1360 message='Support for multi-dimensional indexing')
-> 1362 ndim = x[:, None].ndim
1363 # we have definitely hit a pandas index or series object
1364 # cast to a numpy array.
1365 if len(w) > 0:
File ~\.conda\envs\Merck\lib\site-packages\pandas\core\series.py:1072, in Series.__getitem__(self, key)
1069 key = np.asarray(key, dtype=bool)
1070 return self._get_rows_with_mask(key)
-> 1072 return self._get_with(key)
File ~\.conda\envs\Merck\lib\site-packages\pandas\core\series.py:1082, in Series._get_with(self, key)
1077 raise TypeError(
1078 "Indexing a Series with DataFrame is not "
1079 "supported, use the appropriate DataFrame column"
1080 )
1081 elif isinstance(key, tuple):
-> 1082 return self._get_values_tuple(key)
1084 elif not is_list_like(key):
1085 # e.g. scalars that aren't recognized by lib.is_scalar, GH#32684
1086 return self.loc[key]
File ~\.conda\envs\Merck\lib\site-packages\pandas\core\series.py:1122, in Series._get_values_tuple(self, key)
1117 if com.any_none(*key):
1118 # mpl compat if we look up e.g. ser[:, np.newaxis];
1119 # see tests.series.timeseries.test_mpl_compat_hack
1120 # the asarray is needed to avoid returning a 2D DatetimeArray
1121 result = np.asarray(self._values[key])
-> 1122 disallow_ndim_indexing(result)
1123 return result
1125 if not isinstance(self.index, MultiIndex):
File ~\.conda\envs\Merck\lib\site-packages\pandas\core\indexers\utils.py:341, in disallow_ndim_indexing(result)
333 """
334 Helper function to disallow multi-dimensional indexing on 1D Series/Index.
335
(...)
338 in GH#30588.
339 """
340 if np.ndim(result) > 1:
--> 341 raise ValueError(
342 "Multi-dimensional indexing (e.g. `obj[:, None]`) is no longer "
343 "supported. Convert to a numpy array before indexing instead."
344 )
ValueError: Multi-dimensional indexing (e.g. `obj[:, None]`) is no longer supported. Convert to a numpy array before indexing instead.
when i do this: sf.plot(train_agg,forecasts_df)Scottfree Analytics LLC
10/10/2023, 11:03 PM