Conceptual Understanding
IndexThe value in the array is obtained by an unsigned integer value.
slicesThat is, the description of a fragment in an array.
One-dimensional arrays
Index of a one-dimensional arrayThe index of a one-dimensional array and the Python list function like this:
slicing a one-dimensional arrayThe slice syntax format for a one-dimensional array is array[index1:index2], which means an array that starts at the INDEX1 index position to the end of the INDEX2 index (not including the index2) position. For example:
When you assign a value to a slice, the value acts on every element in the array fragment, for example:
Two-dimensional arrays
Index of a two-dimensional arrayWhen accessing a two-dimensional array with an indexed one-dimensional array, the obtained element is not a scalar but a one-dimensional array. For example:
Since the index of the two-dimensional array is returned as a one-dimensional array, one of the scalars can be accessed in the form of a one-dimensional array, for example:
slicing a two-dimensional arraySince the index of a two-dimensional array corresponds to a one-dimensional array, the slice of a two-dimensional array is a fragment of one-dimensional array:
multidimensional Arrays
index of multidimensional arraysIn a one-dimensional array, a single index value returns the corresponding scalar, and in a two-dimensional array, a single index value returns the corresponding one-dimensional array; In a multidimensional array, a single index value returns an array of a lower latitude, for example:
Boolean index
A Boolean index refers to an array of Boolean values that can be indexed as an array, and the returned data is a value corresponding to the location of the true value, for example:
Fancy Index
A fancy index refers to an array of integers for indexing. For example:
The next essay is: Data analysis using Python (vi) NumPy base: Ndarray vector operations, interested friends Welcome to pay attention to this blog, but also welcome you to add comments to discuss.
Data analysis using Python (v) NumPy Basics: Ndarray indexes and slices