Indexing in NumPy
This lesson will help you learn indexing in NumPy.
Indexing means to refer to any value in an array. Each item in a numpy array is stored at a specific index. To access value at a specific index write:
Z=np.arrange(9)
Z[0] #get the value at index 0
Get the First Value
To get the first value of a matrix, write: Z[0,0]
.
┏━━━┓───┬───┐ ┏━━━┓
┃ 0 ┃ 1 │ 2 │ → ┃ 0 ┃ (scalar)
┗━━━┛───┼───┤ ┗━━━┛
Z │ 3 │ 4 │ 5 │
├───┼───┼───┤
│ 6 │ 7 │ 8 │
└───┴───┴───┘