Numpy shape function returns

Why the shape of array [1 2 3 4 ] is (4,)
Is it 4*1 ie a matrix with 4 row and 1 column

Hey @aakashsharma845, to create a matrix of 4 row and 1 column you must have something like this,
[ [1],
[2],
[3],
[4]]
Whereas here you have only [1,2,3,4]. The earlier one was in 2-D, but [1,2,3,4] is in 1-D, so its shape will be (4,) and not (4,1)

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

1 Like

Thanks a lot for reply , now I get it .

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.