Nixtla / utilsforecast

https://nixtlaverse.nixtla.io/utilsforecast
Apache License 2.0
40 stars 6 forks source link

Getting an error when using plot_series #31

Closed iamyihwa closed 10 months ago

iamyihwa commented 10 months ago

Thanks for the great library and constant developments of multiple tools!

I saw this plotting function so might explore it instead of the statsforecast's plot function, but got an error.

ValueError: Multi-dimensional indexing (e.g. obj[:, None]) is no longer supported. Convert to a numpy array before indexing instead.

I was simply trying the example from here:

from utilsforecast.data import generate_series
level = [80, 95]
series = generate_series(4, freq='D', equal_ends=True, with_trend=True, n_models=2, level=level)
test_pd = series.groupby('unique_id', observed=True).tail(10).copy()
train_pd = series.drop(test_pd.index)
fig = plot_series(
    train_pd,
    forecasts_df=test_pd,
    ids=[0, 3],
    plot_random=False,
    level=level,    
    max_insample_length=50,
    engine='matplotlib',
    plot_anomalies=True,
)
iamyihwa commented 10 months ago

Saw same error in the Statsforecast.plot By using engine='plotly', the error disappeared.

from statsforecast import StatsForecast StatsForecast.plot(df) -> Gives error

from statsforecast import StatsForecast StatsForecast.plot(df , engine = 'plotly') -> Plots fine.

jmoralez commented 10 months ago

Hey. Like in https://github.com/Nixtla/statsforecast/issues/623, this isn't a problem with the plot function but an incompatibility between your matplotlib and pandas versions. It should work fine if you reinstall them.