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:
- Một số vi xử lý AMD Ryzen 5 5600X và Ryzen 7 5800X có hai cụm CCD thay vì chỉ có mộ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
I am getting an attribute error 'builtin_function_or_method' object has no attribute 'reshape'. What to do?
sir what about AttributeError: 'list' object has no attribute 'reshape'
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?
Thank you! Made it easy to understand
Awesome, to-the-point explanation. Thanks
straight to the damn point, Good one !!
How simply you did that!!! Amazing 👏👏
helped me a lot sir, spent hours on figuring out that column.😅
Thanks! I was struggling with what the -1 meant
thanks
Thanks for making it clear !!!
You're a G bro! Subscribed!
Thanks man,
Clean explanation, keep it up. Thanks a lot!!
Thanku bro
Thank you! This was super helpful!!!
Straight into the point .Good job
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
thank you Bhavesh, finally someone answered my question!
x = x.reshape(len(x), 1) or in this case x = x.reshape(100, 1) will also do the work
Thanks, this saved a lot of time for me.
Well explained. Thank yoi
Nice and simple explanation 🙂
Thanks for the very fast, simple explanation!
Amazing ! Great stuff ,thanks a lot .This was such a help . All the Best 🙂
but the latter 1, it's add a dimension or convert into 1 dimension?
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.
You're amazing! Thanks for taking the time to share, this was a huge help 🙏🏼
thank you sir ,
Your explanation is good. But why 2D array is needed here?
you are a life saver thank you
it was very helpful. thank you
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?
Thanks it helped