numpy.ravel() in Python

The numpy.ravel() returns a contiguous flattened array(1-D array), containing the elements of the input.

Syntax

Parameter

The numpy.ravel() method consists of two parameters, which are as follows:

a: This parameter represents an Input array. The elements in ‘a’ are read in the order specified by order, and packed as a 1-D array.

order : This parameter can be either C_contiguous or F_contiguous where C order operates row-rise on the array and  F order operates column-wise operations.

Return

This function returns an array of the same subtype as parameter ‘a’, with shape (a.size,). 

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This