git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]# Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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? Any tip? Thank you, Markos

- Prev by Date:
**help with python37.dll** - Next by Date:
**Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )** - Previous by thread:
**help with python37.dll** - Next by thread:
**Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )** - Index(es):