numpy.ma.flatten_structured_array#
- ma.flatten_structured_array(a)[原始碼]#
Flatten a structured array.
The data type of the output is chosen such that it can represent all of the (nested) fields.
- 參數:
- astructured array
- 回傳值:
- outputmasked array or ndarray
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.]])