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

3.33
3
Kyothine 95 points

                                    Y.values.reshape(-1,1)

3.33 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source