, , , . /. , - :
import numpy as np
arr = np.arange(10).reshape(5,2)
arr[2,1] == arr[(2,1)]
( ) -:
arr[[2,1]]
arr 1, 2, arr[2]==arr[2,:], arr[1]==arr[1,:] ( 2 1) .
:
print(arr[1:3,0:2])
print(arr[[1,2],[0,1]])
- , 1 2 0 1 ; 2- . - , arr[1,0],arr[2,1] , .. , , , zip() .
flat : flatiter . help(arr.flat):
class flatiter(builtins.object)
| Flat iterator object to iterate over arrays.
|
| A `flatiter` iterator is returned by ``x.flat`` for any array `x`.
| It allows iterating over the array as if it were a 1-D array,
| either in a for-loop or by calling its `next` method.
, arr.flat 1d-.
arr.flat[ [3, 4] ]
1d, ; .
arr.flat[ (3,4) ]
(3,4) 1d (!), . , IndexError, , , arr.flat .