numpy.flip () in Python

About:
numpy.flip (array, axis): changes the order of the array elements along the specified axis while maintaining the shape of the array. 
Parameters :

  array:  [array_like] Array to be input  axis:  [integer] axis along which array is reversed. 

Returns:

 reversed array with shape preserved 

# Python program, illustrating
# numpy.flip () method

 

import numpy as geek

 

array = geek.arange ( 8 ). reshape (( 2 , 2 , 2 ))

print ( " Original array: " , array)

< p>  

print ( "Flipped array:" , geek.flip (array, 0 )) 

Exit:

 Original array: [[[0 1] [2 3]] [[4 5] [6 7]]] Flipped array: [[[4, 5] [6, 7 ]] [[0, 1] [2, 3]]] 

Links:
https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.flip.html#numpy.flip

Notes:
These codes will not work for online IDs. Please run them on your systems to see how they work.
,
This article is provided by Mohit Gupta_OMG