package np

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module NumpyRaw.FlatiterSource

Sourcetype tag = [
  1. | `Flatiter
]
Sourcetype t = [ `Flatiter | `Object ] Obj.t
Sourceval of_pyobject : Py.Object.t -> t
Sourceval to_pyobject : [> tag ] Obj.t -> Py.Object.t
Sourceval create : unit -> t

Flat iterator object to iterate over arrays.

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.

See Also -------- ndarray.flat : Return a flat iterator over an array. ndarray.flatten : Returns a flattened copy of an array.

Notes ----- A `flatiter` iterator can not be constructed directly from Python code by calling the `flatiter` constructor.

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

>>> fl2:4 array(2, 3)

Sourceval __getitem__ : key:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Return selfkey.

Sourceval __iter__ : [> tag ] Obj.t -> Py.Object.t

Implement iter(self).

Sourceval __setitem__ : key:Py.Object.t -> value:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Set selfkey to value.

Sourceval to_string : t -> string

Print the object to a human-readable representation.

Sourceval show : t -> string

Print the object to a human-readable representation.

Sourceval pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.