Basic understanding of the array: dimension, axis, indexing, slicing (data collection)

The dimension NumPy (dimension), shaft (axis), rank (rank) meaning (in-depth understanding highly recommend)

https://blog.csdn.net/Babyfatliang/article/details/87721282

  • This article explains: axis dimension = = rank. And how to calculate, how to understand the calculation.
    A picture seen how cattle
  • You can get a glimpse of twelve by this picture.

The dimension of the array to be understood as a nested structure (briefly described)

https://blog.csdn.net/qq_42383041/article/details/86157702

a = np.array([[1,2,3],[1,2,3]])
print(np.sum(a,axis = 0))
>>>[2 4 6]
print(np.sum(a,axis = 1))
>>>[6 6]
print(np.sum(a))
>>>12
  • The first [2,3] considered as x, the second [2,3] seen y, changes arr [x, y] which can be seen as a one-dimensional array in accordance with a so-dimensional I appreciated that the array x, y in this order on the axis 0, i.e. the axis 0 [x, y] = [[1,2,3], [1,2,3]].
  • When Axis = 1, a first dimension (a first nesting) unchanged, i.e., the addition of a second dimension (a second nesting), that is [3,1 + 1 + 2 + 3 + 2] = [6,6].
  • When no parameters axis, all the elements are added, namely 12.
  • Dimensionality reduction method to calculate, if the dimensions down to two-dimensional, then it is for us to understand, simply means "replace, dimension reduction combat."

An array of supplemental index

https://blog.csdn.net/sinat_34072381/article/details/84448307

  • Nested slightly different here, a first number represents the first array dimension, the second dimension representing a second number, the third number represents the third dimension, and so on.
  • E.g. A [[0,1]] 0,1 axis represents the position of elements, the result array dimension is 1, and A [[[0,1]]] Equivalent
  • Note that here, the index of the first layer brackets or square brackets, can be separated by a comma, with the increase in the partition of the index will increase the number of dimensions of the array results. Such as: d = b [[[0,0], [1,1]], [[1,3], [2,3]]] returns the intersection region.
Released seven original articles · won praise 42 · views 4700

Guess you like

Origin blog.csdn.net/qq_37808565/article/details/104472076