numpy.ma.flatten_structured_array#

ma.flatten_structured_array(a)[source]#

Flatten a structured array.

The data type of the output is chosen such that it can represent all of the (nested) fields.

Parameters:
astructured array
Returns:
outputmasked array or ndarray

A flattened masked array if the input is a masked array, otherwise a standard ndarray.

Examples

>>> ndtype = [('a', int), ('b', float)]
>>> a = np.array([(1, 1), (2, 2)], dtype=ndtype)
>>> np.ma.flatten_structured_array(a)
array([[1., 1.],
       [2., 2.]])