Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nondaily time series breaks #1

Closed
AzulGarza opened this issue Dec 6, 2021 · 0 comments · Fixed by #2
Closed

Nondaily time series breaks #1

AzulGarza opened this issue Dec 6, 2021 · 0 comments · Fixed by #2

Comments

@AzulGarza
Copy link
Member

Using non-daily time series throws the following error:

image

The minimum reproducible example would be,

import numpy as np
import pandas as pd

from statsforecast import StatsForecast
from statsforecast.models import random_walk_with_drift

rng = np.random.RandomState(0)
serie1 = np.arange(1, 8)[np.arange(100) % 7] + rng.randint(-1, 2, size=100)
serie2 = np.arange(100) + rng.rand(100)
series = pd.DataFrame(
    {
        'ds': pd.date_range('2000-01-01', periods=serie1.size + serie2.size, freq='M'),
        'y': np.hstack([serie1, serie2]),
    },
    index=pd.Index([0] * serie1.size + [1] * serie2.size, name='unique_id')
)

fcst = StatsForecast(series, models=[random_walk_with_drift], freq='M')
forecasts = fcst.forecast(5)                                       

I think the problem might be solved using pd.DatetimeIndex on self.last_dates. I'll open a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant