import pandas as pd df = pd.read_csv(r'C:\Users\Public\Meds.csv', header=None) df.head()
0 1 0 ds y 1 2023-01-01 102 2 2023-01-02 114 3 2023-01-03 123 4 2023-01-04 116
I get this output when running m.fit(df).
I have two columns one with the date formatted as year month day and the second column with number values.
The first column has ds and the second has y so nothing complicated with the csv file. Any help why Prophet can't work with the csv would be appreciated.
ValueError Traceback (most recent call last) Cell In[141], line 1 ----> 1 m.fit(df)
File ~\AppData\Local\anaconda3\Lib\site-packages\prophet\forecaster.py:1117, in Prophet.fit(self, df, **kwargs) 1114 raise Exception('Prophet object can only be fit once. ' 1115 'Instantiate a new object.') 1116 if ('ds' not in df) or ('y' not in df): -> 1117 raise ValueError( 1118 'Dataframe must have columns "ds" and "y" with the dates and ' 1119 'values respectively.' 1120 ) 1121 history = df[df['y'].notnull()].copy() 1122 if history.shape[0] < 2:
ValueError: Dataframe must have columns "ds" and "y" with the dates and values respectively.
made sure ds and y are lower case and are in the correct columns. I can send the example sheet if it would help.