mirror of
https://github.com/davrot/pytutorial.git
synced 2025-06-09 13:00:02 +02:00
Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
b97c20b484
commit
337e38e2c1
1 changed files with 12 additions and 3 deletions
|
@ -94,10 +94,19 @@ print(a[4:-2:-1]) # -> []
|
||||||
print(a[-1:5:-1]) # -> [9 8 7 6]
|
print(a[-1:5:-1]) # -> [9 8 7 6]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Views
|
|
||||||
|
|
||||||
### [... (Ellipsis)](https://docs.python.org/dev/library/constants.html#Ellipsis)
|
### [... (Ellipsis)](https://docs.python.org/dev/library/constants.html#Ellipsis)
|
||||||
|
|
||||||
> The same as the ellipsis literal “...”. Special value used mostly in conjunction with extended slicing syntax for user-defined container data types. Ellipsis is the sole instance of the types.EllipsisType type.
|
> The same as the ellipsis literal “...”. Special value used mostly in conjunction with extended slicing syntax for user-defined container data types. Ellipsis is the sole instance of the types.EllipsisType type.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
a = np.empty((2, 3, 4, 5, 6, 7, 8))
|
||||||
|
print(a.shape) # -> (2, 3, 4, 5, 6, 7, 8)
|
||||||
|
print(a[..., 1:2].shape) # -> (2, 3, 4, 5, 6, 7, 1)
|
||||||
|
print(a[:, :, 1:2, ...].shape) # -> (2, 3, 1, 5, 6, 7, 8)
|
||||||
|
print(a[0, ...].shape) # -> (3, 4, 5, 6, 7, 8)
|
||||||
|
print(a[0, ..., 0].shape) # -> (3, 4, 5, 6, 7)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Views
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue