On 2019-06-21 02:39, Markos wrote:
Hi,
I'm studying Numpy and I don't understand the difference between
vector_1 = np.array( [ 1,0,1 ] )
with 1 bracket and
vector_2 = np.array( [ [ 1,0,1 ] ] )
with 2 brackets
The shape of vector_1 is:
vector_1.shape
(3,)
But the shape of vector_2 is:
vector_2.shape
(1, 3)
The transpose on vector_1 don't work:
vector_1.T
array([1, 0, 1])
But the transpose method in vector_2 works fine:
vector_2.T
array([[1],
[0],
[1]])
I thought that both vectors would be treated as an matrix of 1 row and 3
columns.
Why this difference?
By similar reasoning, why not 3-dimensional (layer, row, column)? Or
4-dimensional?
--
https://mail.python.org/mailman/listinfo/python-list