From 6c315bb35eb04f021f65973202106b461e159218 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Wed, 27 Dec 2023 14:12:11 +0100 Subject: [PATCH] Update README.md Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com> --- numpy/nditer/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/numpy/nditer/README.md b/numpy/nditer/README.md index f2a0324..a6e0a2a 100644 --- a/numpy/nditer/README.md +++ b/numpy/nditer/README.md @@ -180,3 +180,35 @@ Output: [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