0

I am using Darts library for the first. After practicing with a given dataset by darts, I'm attempting to use my own dataset, which is in pandas dataframe form. I am using the classmethod called "from_dataframe" as listed in the documentation, but I'm having some trouble

(doc: https://unit8co.github.io/darts/generated_api/darts.timeseries.html#darts.timeseries.TimeSeries.from_dataframe)

My data looks like this:

enter image description here

and below is the code I wrote:

series = TimeSeries.from_dataframe(sample_df, time_col="Fiscal_Date", value_cols="Sales", fill_missing_dates=True, freq="M")

But I'm getting the following error:

ValueError: cannot reindex from a duplicate axis

I do know that there is no duplicate axis, but I still double checked by

df.index.duplicated()

I've been confused with this for a few days now, but I just can't seem to be able to figure out what I'm doing wrong. Can anyone please give me a piece of advice?

Thank you!

1 Answers1

0

According the documentation the 'time_col' should be a pandas DatetimeIndex

I solved it by defining the date column as: df['Date1'] = pd.date_range(start='9/1/2021', end = '02/21/2022', freq='D')