Reshape your data either X.reshape(-1, 1) if your data has a single feature/column and X.reshape(1, -1) if it contains a single sample. If you are getting this error then in this video, I plan to demystify the confusion surrounding numpy reshape (1,-1) function.
I’ll use a simple example to explain what does -1 mean in numpy reshape.
If you do have any questions with what we covered in this video then feel free to ask in the comment section below & I’ll do my best to answer those.
If you enjoy these tutorials & would like to support them then the easiest way is to simply like the video & give it a thumbs up & also it’s a huge help to share these videos with anyone who you think would find them useful.
Please consider clicking the SUBSCRIBE button to be notified for future videos & thank you all for watching.
You can find me on:
Blog –
Twitter –
GitHub –
Medium –
#Reshape #Numpy #Python
Nguồn: https://zagran-tour.com/
Xem thêm bài viết khác: https://zagran-tour.com/cong-nghe/
Xem thêm Bài Viết:
- Liên quân Reset Rank Mùa 12 ⭐ Trang Phục Miễn Phí Fennik Tay Đua F1 Mùa 14 Trải Nghiệm Game
- How to Reset Adobe Photoshop 2020 to Default Settings
- Reset Windows Server 2012/R2 Domain/Local Administrator Password
- Windows 10 – How to Reset Your Forgotten Windows 10 Password
- How to Fix Forgotten Windows 7 Password – Bypass Login Screen & Reset Password
Rahul Kole
•8 months ago
I am getting an attribute error 'builtin_function_or_method' object has no attribute 'reshape'. What to do?
carlos fotsing
•8 months ago
sir what about AttributeError: 'list' object has no attribute 'reshape'
Lex Li
•8 months ago
thank you, Bhavesh. this is v helpful. one follow up question, why do we only reshape x? why don't reshape both X and y?
Tommy Phillips
•8 months ago
Thank you! Made it easy to understand
Germán Distel
•8 months ago
Awesome, to-the-point explanation. Thanks
shiva kumar
•8 months ago
straight to the damn point, Good one !!
Harsh Patel
•8 months ago
How simply you did that!!! Amazing 👏👏
Faique Jatu
•8 months ago
helped me a lot sir, spent hours on figuring out that column.😅
urbaneplanner
•8 months ago
Thanks! I was struggling with what the -1 meant
Ameer ul Islam
•8 months ago
thanks
Suraj Verma
•8 months ago
Thanks for making it clear !!!
Kenny Osubor
•8 months ago
You're a G bro! Subscribed!
Sanjay S
•8 months ago
Thanks man,
RENZO ANDRE GONZALES MALDONADO
•8 months ago
Clean explanation, keep it up. Thanks a lot!!
Kushal Hu
•8 months ago
Thanku bro
CJ Johanson
•8 months ago
Thank you! This was super helpful!!!
Nandhagopal cs
•8 months ago
Straight into the point .Good job
Sachin Ladhad
•8 months ago
Please let me know why linear regression function is expecting 2D array or let me know where I can read the reason behind linear regression why it expects 2D array
fangyu wang
•8 months ago
thank you Bhavesh, finally someone answered my question!
Animesh Sharma
•8 months ago
x = x.reshape(len(x), 1) or in this case x = x.reshape(100, 1) will also do the work
Rohan Ahire
•8 months ago
Thanks, this saved a lot of time for me.
Emmanuel Masabo
•8 months ago
Well explained. Thank yoi
Mukesh Patel
•8 months ago
Nice and simple explanation 🙂
V K
•8 months ago
Thanks for the very fast, simple explanation!
tom tom
•8 months ago
Amazing ! Great stuff ,thanks a lot .This was such a help . All the Best 🙂
MARS HUO
•8 months ago
but the latter 1, it's add a dimension or convert into 1 dimension?
Mazahir Saleem
•8 months ago
I want to take csv file as my input. how can i reshape my data particularly the x variable in my csv file. every time i took a scv file as input and there occurs a dimensional error.
Cara Gillespie
•8 months ago
You're amazing! Thanks for taking the time to share, this was a huge help 🙏🏼
Vinod R
•8 months ago
thank you sir ,
Snehashish Banerjee
•8 months ago
Your explanation is good. But why 2D array is needed here?
Mohammed Al Tameemi
•8 months ago
you are a life saver thank you
bushwalkernsw
•8 months ago
it was very helpful. thank you
Dhruvin Suthar
•8 months ago
Hi, I am trying to do reshape to another dataset but I am getting an error "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()." What is the best ways to solve it?
AK S
•8 months ago
Thanks it helped