Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
a54a2c096e
commit
0bd475f4d2
1 changed files with 13 additions and 0 deletions
|
@ -35,6 +35,8 @@ print(a[:6]) # -> [0 1 2 3 4 5]
|
|||
print(a[5:]) # -> [5 6 7 8 9]
|
||||
print(a[:]) # -> [0 1 2 3 4 5 6 7 8 9]
|
||||
print(a[...]) # -> [0 1 2 3 4 5 6 7 8 9]
|
||||
print(a[:9999]) # -> [0 1 2 3 4 5 6 7 8 9]
|
||||
print(a[9999:]) # ->[]
|
||||
```
|
||||
|
||||
* Negative values for start and stop are understood as N-\|start\| and N-\|stop\|
|
||||
|
@ -80,3 +82,14 @@ print(a[-3:-1]) # -> [7 8]
|
|||
print(a[-1:-8]) # -> []
|
||||
print(a[-9999:]) # -> [0 1 2 3 4 5 6 7 8 9]
|
||||
```
|
||||
|
||||
Negative step sizes:
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
a = np.arange(0, 10)
|
||||
print(a) # -> [0 1 2 3 4 5 6 7 8 9]
|
||||
print(a[::-1]) # -> [9 8 7 6 5 4 3 2 1 0]
|
||||
print(a[4:-2:-1]) # -> []
|
||||
print(a[-1:5:-1]) # -> [9 8 7 6]
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue