1
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?

1
  • 1
    This is a 1d array. not 1 X 3 matrix, a 1X3 matrix looks like [[1,2,3]]. Commented Dec 30, 2016 at 21:04

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.