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
229d807e27
commit
6c315bb35e
1 changed files with 32 additions and 0 deletions
|
@ -180,3 +180,35 @@ Output:
|
||||||
[2 5 8]
|
[2 5 8]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## external_loop and buffered
|
||||||
|
|
||||||
|
> **flags** : sequence of str, optional
|
||||||
|
>
|
||||||
|
> **buffered** enables buffering when required.
|
||||||
|
|
||||||
|
Depending on the memory order you might get a set of chunks instead of one array. You can modify this via the **buffered** flag.
|
||||||
|
|
||||||
|
```python
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
a = np.arange(0, 9).reshape(3, 3)
|
||||||
|
|
||||||
|
print(a)
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
for i in np.nditer(a, flags=["external_loop", "buffered"], order="F"):
|
||||||
|
print(i)
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```python
|
||||||
|
[[0 1 2]
|
||||||
|
[3 4 5]
|
||||||
|
[6 7 8]]
|
||||||
|
|
||||||
|
[0 3 6 1 4 7 2 5 8]
|
||||||
|
```
|
||||||
|
|
||||||
|
## {c,f}_index
|
||||||
|
|
Loading…
Add table
Reference in a new issue