How to Convert 2-D Arrays to 1-D Arrays
There are 3 methods to convert 2-D arrays to 1-D ones in Numpy. The following shows the key syntax. Method 1: numpy.ravel() Method 2: ndarray.flatten(order=’C’) Method 3: ndarray.reshape(-1) Example 1 (Method 1): We can use numpy.ravel() to convert 2-D arrays to 1-D ones. Below is the example. Output: 2-D array: [[ 5 2 3 4 … Read more