feature_names = X.columns
feature_names = np.array(feature_names)
feature_names = feature_names.reshape(60,1)
X = np.nan_to_num(X)
Y = np.nan_to_num(Y)
lr = LinearRegression()
model = lr.fit(X,Y)
model_coefs = model.coef_
coefs1 = pd.DataFrame(
data={'feature': feature_names,
"orig_coefs" : model_coefs})
print coefs1
I keep getting the "If using all scalar values, you must pass an index" error when trying to print the table coefs1. this is quite frustrating as I've used this code in the past to list all my variable names in my X and match them up with their coefficients after the model is built. In this example I have 60 variables in my X and I reshaped it to be 1 dimensional to match with my coefficients that are (60 ,1).
I just cannot wrap my head around how this one instance is giving me this error, when i go to different examples of my past work using variations of this syntax everything runs fine.