MaskedArray.flatten()

numpy.ma.MaskedArray.flatten

MaskedArray.flatten(order='C')

Return a copy of the array collapsed into one dimension.

Parameters:

order : {‘C’, ‘F’, ‘A’}, optional

Whether to flatten in row-major (C-style) or column-major (Fortran-style) order or preserve the C/Fortran ordering from a. The default is ‘C’.

Returns:

y : ndarray

A copy of the input array, flattened to one dimension.

See also

ravel
Return a flattened array.
flat
A 1-D flat iterator over the array.

Examples

>>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])

© 2008–2016 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.ma.MaskedArray.flatten.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部