bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ma / core / fromflex
function
numpy.ma.core:fromflex
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :8678
Signature
def fromflex ( fxarray ) Summary
Build a masked array from a suitable flexible-type array.
Extended Summary
The input array has to have a data-type with _data and _mask fields. This type of array is output by MaskedArray.toflex.
Parameters
fxarray: ndarrayThe structured input array, containing
_dataand_maskfields. If present, other fields are discarded.
Returns
result: MaskedArrayThe constructed masked array.
Examples
import numpy as np x = np.ma.array(np.arange(9).reshape(3, 3), mask=[0] + [1, 0] * 4) rec = x.toflex() rec x2 = np.ma.fromflex(rec) x2Extra fields can be present in the structured array but are discarded:
dt = [('_data', '<i4'), ('_mask', '|b1'), ('field3', '<f4')] rec2 = np.zeros((2, 2), dtype=dt) rec2 y = np.ma.fromflex(rec2) y
See also
- MaskedArray.toflex
Build a flexible-type array from a masked array.
Aliases
-
numpy.ma.fromflex