We make two new arrays firstly,
1 | A = np.arange(0,6) |
One-dimensional
It mostly likes list in original Python
1 | A[0] #0 |
Two-dimensional
It is also likely to Python,
1 | B[0][0] #0 |
For array traversal, there is also a normal way
1 | for row in B: |
If we wanna traversal the column of the array, there is not given a function to do that instance, but we can transpose the array firstly,
1 | for column in B.T: |
If we wanna change or output every item in the array, we would like to use an inner function called flat
, but be careful, it will be a iterator.
1 | for item in B.flat: |
For this function, actually, we can use it to output everything in the array, the key word needed to change flatten
and the type of output is an array.
1 | B.flatten() |
Thanks for your reading, I hope it is useful for you.
End
Illustrator / Cagy
Text / Cagy
Editor / Cagy
Design / Cagy