flat numpy array 1

flat numpy array

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

Here is what the above code is Doing:
1. We create a 2-dimensional array with 2 rows and 2 columns.
2. We flatten the array.
3. We print the flattened array.

Similar Posts