You are viewing an older version (2.4.3).Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / core / MaskedArray / toflex

function

numpy.ma.core:MaskedArray.toflex

source: /numpy/ma/core.py:6405

Signature

def toflex(self)

Summary

Transforms a masked array into a flexible-type array.

Extended Summary

The flexible type array that is returned will have two fields:

  • the _data field stores the _data part of the array.

  • the _mask field stores the _mask part of the array.

Parameters

None

Returns

record : ndarray

A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape.

Notes

A side-effect of transforming a masked array into a flexible ndarray is that meta information (fill_value, ...) will be lost.

Examples

import numpy as np
x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
x
x.toflex()

Aliases

  • numpy.ma.MaskedArray.toflex