Update README.md

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-14 16:44:49 +01:00 committed by GitHub
parent a54a2c096e
commit 0bd475f4d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]
```