Parameters :
array: [array_like] Input array. order: [Ccontiguous, Fcontiguous, Acontiguous; optional] Ccontiguous order in memory (last index varies the fastest) C order means that operating rowrise on the array will be slightly quicker FORTRANcontiguous order in memory (first index varies the fastest). F order means that columnwise operations will be faster. `A` means to read / write the elements in Fortranlike index order if, array is Fortran contiguous in memory, Clike order otherwise
Return:
Flattened array having same type as the Input array and and order as per choice.
Code 1: Shows that array.ravel is equivalent to reshaping (1, order = order)

Output:
Original array: [[0 1 2 3 4] [5 6 7 8 9] [10 11 12 13 14]] ravel (): [0 1 2 ..., 12 13 14] numpy.ravel () == numpy.reshape (1) Reshaping array: [0 1 2 ..., 12 13 14]Code 2: Shows order manipulation
Output:
Original array: [[0 1 2 3 4] [5 6 7 8 9] [10 11 12 13 14]] About numpy.ravel (): numpy.ravel (): [0 1 2 ..., 12 13 14] Maintains A Order: [0 1 2 ..., 12 13 14] array2 [[[0 2 4] [1 3 5]] [[6 8 10] [7 9 11]]] Maintains A Order: [0 1 2 ..., 9 10 11]Links:
https:// docs.scipy.org/doc/numpydev/reference/generated/numpy.ravel.html#numpy.ravelNotes:
These codes will not work for online ID. Please run them on your systems to see how they workThis article is provided by Mohit Gupta_OMG
XSubmit new EBook
