r/pythonhelp • • Oct 31 '20

'float' object is not subscriptable

Hey guys,

so I want to ge this code to run but I always get the error message: TypeError: 'float' object is not subscriptable because of the last line. X is a data frame with 3 columns and y is a data frame with one column both with date time index.

What am I doing wrong? Should I change the data input?

model = lr().fit(X, y)

summary_result = pd.DataFrame(columns = ['y_hat'])

yhat_list = [float(i[0]) for i in np.ndarray.tolist(model.predict(X))]

3 Upvotes

0 comments sorted by