reshape array python'Series' object has no attribute 'reshape' code example
Example 1: attributeerror 'series' object has no attribute 'reshape' numpy concatenate
#I run in some issues in Predicting the Test set Results from
#multiple Linear Regression and I found the problem was that when
#I pass the values from pandas Dataframe I didn't pass as numpy
#array first
data = pd.read_csv('Data.csv')
x=np.array(data.iloc[:,:-1])
y=np.array(data.iloc[:,-1])
.
.
.
.
# Predicting the Test set Results
y_pred = regressor.predict(x_test)
np.set_printoptions(precision=2) # Number of digitis of precision for floating point output (default 8).and
print(np.concatenate((y_pred.reshape(len(y_pred),1),y_test.reshape(len(y_test),1)),1))
# Now runs just fine
Example 2: series has no attirubte reshape python
Y.values.reshape(-1,1)