When I check the shape of an array using numpy.shape()
, I sometimes get (length,1)
and sometimes (length,)
. It looks like the difference is a column vs. row vector... but It doesn't seem like that changes anything about the array itself [except some functions complain when I pass an array with shape (length,1)
].
What is the difference between these two?
Why isn't the shape just, (length)
?
The point is that say a vector can be seen either as
You can add dimensions using
[:, np.newaxis]
syntax or drop dimensions usingnp.squeeze
: