I have a pandas data frame like this:
(index) 0 sie
0 1997-01-01 11.2
1 1997-01-03 12.3
2 1997-01-04 11.5
...
12454 2017-02-01 13.2
I would like to use SVM to predict the future values of the sie
. How can I implement python code to predict these values?
I am doing something like this:
model = svm.SVR().fit(df[0],df['sie'])
But it is giving me this error:
ValueError: Found input variables with inconsistent numbers of samples: [1, 12455]
Although both df[0]
anddf['sie']
have same shape of (12455,)
Note: I don't have continuous data (some dates, in between, are missing), also values in 0
are datetime.date()
objects.
model = svm.SVR().fit(df['0'],df['sie'])
$\endgroup$KeyError: '0'
. I don't think this is a problem though.. $\endgroup$df.rename(columns={0:'Dates'}, inplace=True)
andmodel = svm.SVR().fit(df['Dates'],df['sie'])
still giving me**ValueError**
$\endgroup$