I want to understand an array for dot product calculation using numpy in python

A = numpy.array (([1,2], [3,4], [5,6]]) two-dimensional array
B = numpy.array ([[1,2]]) 2D array
C = numpy.array ([3,4]) 1D array


Error message

Although A can be understood up to 3 rows and 2 columns and B can be understood up to 1 rows and 2 columns,
I don't know why C is 2 lines.
When examined, one-dimensional arrays are numbers arranged side by side.
(1,) I thought it would be one line.

  • Answer # 1

    In this regard, you need to understand concepts such as ndim, shape and axis. Please refer to the appropriate article.

    What does NumPy's axis and dimension number (ndim) mean?-DeepAge

    Other miscellaneous things.

    C in the question sentence is not called "2 lines". Usually called a one-dimensional array with two elements

    shape numbers do not correspond to rows or columns. In 2D, for convenience, axis 0 is sometimes referred to as row and 1 as column.

    The 1D and 2D arrays are not related to the vector dimensions. Rather, it may be better to think of it as a tensor, but it is not so expensive because it is a data structure. If it's a mess, it's the number of subscripts.

  • Answer # 2

    In the one-dimensional case, it looks like (number of elements).