numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesBackRef

A flatiter iterator is returned by x.flat for any array :None:None:`x`. It allows iterating over the array as if it were a 1-D array, either in a for-loop or by calling its :None:None:`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.

Flat iterator object to iterate over arrays.

See Also

ndarray.flat

Return a flat iterator over an array.

ndarray.flatten

Returns a flattened copy of an array.

Examples

>>> x = np.arange(6).reshape(2, 3)
... fl = x.flat
... type(fl) <class 'numpy.flatiter'>
>>> for item in fl:
...  print(item) ... 0 1 2 3 4 5
>>> fl[2:4]
array([2, 3])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.lib.arrayterator.Arrayterator numpy.nditer numpy.ndindex numpy.ndenumerate numpy.flatiter

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/__init__.py#None
type: <class 'type'>
Commit: