bundles / numpy latest / numpy / flatiter
class
numpy:flatiter
source: /dev/numpy/build-install/usr/lib/python3.14/site-packages/numpy/__init__.py
Signature
class flatiter ( ) Summary
Flat iterator object to iterate over arrays.
Extended Summary
A flatiter iterator is returned by x.flat for any array x. It allows iterating over the array as if it were a 1-D array, either in a for-loop or by calling its next method.
Iteration is done in row-major, C-style order (the last index varying the fastest). The iterator can also be indexed using basic slicing or advanced indexing.
Notes
A flatiter iterator can not be constructed directly from Python code by calling the flatiter constructor.
Examples
import numpy as np x = np.arange(6).reshape(2, 3) fl = x.flat type(fl) for item in fl: print(item)✓
fl[2:4]
✓See also
- ndarray.flat
Return a flat iterator over an array.
- ndarray.flatten
Returns a flattened copy of an array.
Aliases
-
numpy.flatiter