mirror of
https://github.com/davrot/pytutorial.git
synced 2025-04-18 21:26:41 +02:00
Update README.md
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
ebee66aa1a
commit
d4692f5665
1 changed files with 10 additions and 0 deletions
|
@ -187,6 +187,16 @@ class slice(start, stop, step=None)
|
|||
>
|
||||
> Slice objects are also generated when extended indexing syntax is used. For example: a[start:stop:step] or a[start:stop, i].
|
||||
|
||||
```python
|
||||
import numpy as np
|
||||
|
||||
idx = np.s_[2:10, 20:100, 10]
|
||||
print(idx) # -> (slice(2, 10, None), slice(20, 100, None), 10)
|
||||
|
||||
data = np.zeros((20, 101, 11))
|
||||
x = data[idx]
|
||||
print(x.shape) # -> (8, 80)
|
||||
```
|
||||
|
||||
|
||||
## [numpy.c_](https://numpy.org/doc/stable/reference/generated/numpy.c_.html)
|
||||
|
|
Loading…
Add table
Reference in a new issue