In [21]: a = np.array([1,2,3])
In [22]: a.shape
Out[22]: (3,)
What's the difference between (3,) and (3,1) in shape?
Why isn't the output (,3) or (1,3)? This is a 1 by 3 matrix, right?
kgf3JfUtW
15.2k12 gold badges63 silver badges92 bronze badges
asked Dec 30, 2016 at 21:03
user697911
10.6k32 gold badges108 silver badges187 bronze badges
-
1This is a 1d array. not 1 X 3 matrix, a 1X3 matrix looks like [[1,2,3]].akuiper– akuiper2016年12月30日 21:04:13 +00:00Commented Dec 30, 2016 at 21:04
1 Answer 1
No. A 1x3 matrix would be a two-dimensional array (e.g., np.array([[1, 2, 3]])). What you have is a one-dimensional array of length three. In mathematical terms, a 1D array roughly corresponds to a vector.
answered Dec 30, 2016 at 21:04
BrenBarn
253k39 gold badges421 silver badges392 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py