package np

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `MaskedIterator
]
type t = [ `MaskedIterator | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : Py.Object.t -> t

Flat iterator object to iterate over masked arrays.

A `MaskedIterator` iterator is returned by ``x.flat`` for any masked 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 C-contiguous style, with the last index varying the fastest. The iterator can also be indexed using basic slicing or advanced indexing.

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

Notes ----- `MaskedIterator` is not exported by the `ma` module. Instead of instantiating a `MaskedIterator` directly, use `MaskedArray.flat`.

Examples -------- >>> x = np.ma.array(arange(6).reshape(2, 3)) >>> fl = x.flat >>> type(fl) <class 'numpy.ma.core.MaskedIterator'> >>> for item in fl: ... print(item) ... 0 1 2 3 4 5

Extracting more than a single element b indexing the `MaskedIterator` returns a masked array:

>>> fl2:4 masked_array(data = 2 3, mask = False, fill_value = 999999)

val __getitem__ : indx:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

None

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

None

val __setitem__ : index:Py.Object.t -> value:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

None

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print the object to a formatter.