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
What does -1 mean in numpy reshape?, numpy reshape (-1 1), numpy.reshape(-1 1), numpy reshape(-1 1), What does -1 in numpy reshape mean?, What does reshaping an array in Python with one dimension set to -1 do?, What exactly is reshape(-1 1) in Numpy & Pandas (Python) ?, numpy reshape, X.reshape(1 -1) if it contains a single sample, reshape(-1 1)
Xem Thêm Bài Viết Về Mobile Khác: https://sealsystem.org/mobile
Nguồn: https://sealsystem.org/
Thanks for the clear explanation Bhavesh!
The thing like this is, "I know it adds dimension, but I don't know how it does". Good thing reviewing such basic. Many thanks to your video.
I appreciate how you simply explained that stuff. I was stuck in my LSTM project and this content helped me to know what is reshape(-1, 1)
Thanks a lot man !! This problem kept kept nagging me for days. You just earned a sub 🙂
Life saver
cool explanation , thank you
Short and sweet. thankyou!
very clear! Thank a lot!
Thanks for your to the point explanation. It saved a lot of time.
Thank you!
Thank you!!!
You solved all my doubts. Awesome video Bhavesh
provider link of machine learning tutorial playlist in your description will save time for us.
Thanks a lot!
You are a saviour buddy
Do we need to do the same way for y ?
y = y.reshape(-1,1)
because when I run lr.fit(x,y)
Message show "TypeError: fit() missing 1 required positional argument: 'y'"
can we use reshape function in a multi linear regression i.e which has multiple features if we can use can you please share code below how to define for a multi linear regression
Thanks for the tutorial sir
I just liked the vid and the number become 666.
Hi..While working on SUV dataset, I got the value error when I tried doing feature scaling using StandardScaler post train test split. Error is: "ValueError: Expected 2D array, got 1D array instead:'." How to resolve the issue?
Also, its little weird that when I am running the same code on google colab I am not getting this error. Could you help me understand, why am I getting this error on my jupyter notebook?
Thanks bhaiya
Thankyou!
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!!
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