Darts/Pandas date parsing issue

684 views Asked by At

Date column in df

I have a date column as you see which is pd datetime on a df. When I tried converting into series I get :

series = TimeSeries.from_dataframe(df,time_col='Date')

ValueError: The time index of the provided DataArray is missing the freq attribute, and the frequency could not be directly inferred. This probably comes from inconsistent date frequencies with missing dates. If you know the actual frequency, try setting fill_missing_dates=True, freq=actual_frequency. If not, try setting fill_missing_dates=True, freq=None to see if a frequency can be inferred.

These are company specific dates so the freq is Business day . When I tried to force it to business days it complains. Can someone help please?

1

There are 1 answers

1
Vintage On

Try:

TimeSeries.from_dataframe(df, fill_missing_dates=True, freq="D", time_col="Date")

If there are other issues with time col - you can also set date as index in dataframe and it should resolve date column issue.

df = df.set_index("Date")