0

I'm practice pycaret.time_series alpha module but I have this problem . Can anyone help?

I use Walmart Dataset and try to groupby Date to make average of Weekly_Sales amoung stores and forcast Weekly_Sales in next 14 days but it didn't work

import pandas as pd
import numpy as np
from pycaret.time_series import *

dataset = pd.read_csv("/content/Walmart.csv")

dataset["Date"] = pd.to_datetime(dataset["Date"])

WSM = dataset.groupby(by=['Date']).agg({'Weekly_Sales': np.mean})

WSM.index = pd.to_datetime(WSM.index)

setup(data = WSM, fold = 3, fh = 14,target = "Weekly_Sales")
ValueError                                Traceback (most recent call last)
<ipython-input-23-48614273390d> in <module>
      1 from pycaret.time_series import *
----> 2 Setup = setup(data = WSM, fold = 3, fh = 14,target = "Weekly_Sales")

5 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/arrays/datetimes.py in to_period(self, freq)
   1152             if freq is None:
   1153                 raise ValueError(
-> 1154                     "You must pass a freq argument as current index has none."
   1155                 )
   1156 

ValueError: You must pass a freq argument as current index has none.

I have already check the pose ValueError: You must pass a freq argument as current index has none and check the type of index is datetime dtype='datetime64[ns]', name='Date', length=143, freq=None

1 Answers1

0

If you try the next version of the pycaret pre-release (3.0.0rc5) which should be released in a few days, this issue will be resolved automatically as there is a new seasonal detection algorithm that has been implemented.

If you are using anything less than 3.0.0rc5, you can try setting seasonal_period = 52 manually in setup since majority of this Walmart data has a yearly seasonality.

Nikhil Gupta
  • 1,436
  • 12
  • 15