numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
fromflex(fxarray)

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 : ndarray

The structured input array, containing _data and _mask fields. If present, other fields are discarded.

Returns

result : MaskedArray

The constructed masked array.

Build a masked array from a suitable flexible-type array.

See Also

MaskedArray.toflex

Build a flexible-type array from a masked array.

Examples

This example is valid syntax, but we were not able to check execution
>>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[0] + [1, 0] * 4)
... rec = x.toflex()
... rec array([[(0, False), (1, True), (2, False)], [(3, True), (4, False), (5, True)], [(6, False), (7, True), (8, False)]], dtype=[('_data', '<i8'), ('_mask', '?')])
This example is valid syntax, but we were not able to check execution
>>> x2 = np.ma.fromflex(rec)
... x2 masked_array( data=[[0, --, 2], [--, 4, --], [6, --, 8]], mask=[[False, True, False], [ True, False, True], [False, True, False]], fill_value=999999)

Extra fields can be present in the structured array but are discarded:

This example is valid syntax, but we were not able to check execution
>>> dt = [('_data', '<i4'), ('_mask', '|b1'), ('field3', '<f4')]
... rec2 = np.zeros((2, 2), dtype=dt)
... rec2 array([[(0, False, 0.), (0, False, 0.)], [(0, False, 0.), (0, False, 0.)]], dtype=[('_data', '<i4'), ('_mask', '?'), ('field3', '<f4')])
This example is valid syntax, but we were not able to check execution
>>> y = np.ma.fromflex(rec2)
... y masked_array( data=[[0, 0], [0, 0]], mask=[[False, False], [False, False]], fill_value=999999, dtype=int32)
See :

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/ma/core.py#8024
type: <class 'function'>
Commit: