I'm trying to implement SVC on NIfty data
but I keep getting this error
" Input contains NaN, infinity or a value too large for dtype('float64')."
This is the code m running
nf = pd.read_csv('C:/Users/Downloads/Nifty.csv')
nf.index = pd.to_datetime(nf.Date)
nf.dropna()
nf.head()
nf['Open-Close'] = nf.Open - nf.Close
nf['High-Low'] = nf.High - nf.Low
x = nf[['Open-Close','High-Low']]
x.head()
#tgt variable
y = np.where(nf['Close'].shift(-1)>nf.Close,1,0)
t = 0.7
t = int(tlen(nf))
#training data
x_train = x[:t]
y_train = y[:t]
#testing data
x_test = x[t:]
y_test = y[t:]
pd.DataFrame(x).fillna('bfill')
x.replace([np.inf, -np.inf], np.nan, inplace=True)
np.where(x.values >= np.finfo(np.float64).max)
x.dropna()
print(x)
#train & test accuracy
accuracy_train = accuracy_score(y_train, cls.predict(x_train))
accuracy_test = accuracy_score(y_test, cls.predict(x_test))
print('\nTrain Accuracy:{: .2f}%'.format(accuracy_train100))
print('Test Accuracy:{: .2f}%'.format(accuracy_test*100))
at this point Im getting following error
Input contains NaN, infinity or a value too large for dtype('float64').