Flatten a structured array.
The data type of the output is chosen such that it can represent all of the (nested) fields.
A flattened masked array if the input is a masked array, otherwise a standard ndarray.
>>> import numpy as np
>>> 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.]])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.ma.flatten_structured_array.html