| [ Web Proxy ] |
| Viewing: https://numpy.org/doc/stable/reference/generated/../generated/numpy.ndarray.flatten.html | [Back] [Original] |
method
Return a copy of the array collapsed into one dimension.
C means to flatten in row-major (C-style) order. F means to flatten in column-major (Fortran- style) order. A means to flatten in column-major order if a is Fortran contiguous in memory, row-major order otherwise. K means to flatten a in the order the elements occur in memory. The default is C.
A copy of the input array, flattened to one dimension.
Examples
>>> import numpy as np
>>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])
| Web Proxy Viewer | New URL | Original Page |