numpy.fliplr() in Python (original) (raw)
Last Updated : 08 Mar, 2024
numpy.fliplr(array) : Flip array(entries in each column) in left-right direction, shape preserved
Parameters :
array : [array_like]Input array, we want to flip
Return :
Flipped array in left-right direction.
import
numpy as geek
array
=
geek.arange(
8
).reshape((
2
,
2
,
2
))
print
(
"Original array : \n"
, array)
print
(
"\nFlipped array left-right : \n"
, geek.fliplr(array))
Output :
Original array : [[[0 1] [2 3]]
[[4 5] [6 7]]]
Flipped array left-right : [[[2 3] [0 1]]
[[6 7] [4 5]]]
Note :
These codes won’t run on online IDE’s. Please run them on your systems to explore the working.
Similar Reads
- numpy.flip() in Python The numpy.flip() function reverses the order of array elements along the specified axis, preserving the shape of the array. Syntax: numpy.flip(array, axis) Parameters : array : [array_like]Array to be input axis : [integer]axis along which array is reversed. Returns : reversed array with shape prese 1 min read
- numpy.flipud() in Python The numpy.flipud() function flips the array(entries in each column) in up-down direction, shape preserved. Syntax: numpy.flipud(array) Parameters : array : [array_like]Input array, we want to flip Return : Flipped array in up-down direction. Python Code # Python Program illustrating # numpy.flipud() 1 min read
- numpy.all() in Python The numpy.all() function tests whether all array elements along the mentioned axis evaluate to True. Syntax: numpy.all(array, axis = None, out = None, keepdims = class numpy._globals._NoValue at 0x40ba726c) Parameters : array :[array_like]Input array or object whose elements, we need to test. axis : 3 min read
- numpy.flatnonzero() in Python numpy.flatnonzero()function is used to Compute indices that are non-zero in the flattened version of arr. Syntax : numpy.flatnonzero(arr) Parameters : arr : [array_like] Input array. Return : ndarray Output array, containing the indices of the elements of arr.ravel() that are non-zero. Code #1 : Wor 1 min read
- numpy.any() in Python The numpy.any() function tests whether any array elements along the mentioned axis evaluate to True. Syntax : numpy.any(a, axis = None, out = None, keepdims = class numpy._globals._NoValue at 0x40ba726c) Parameters : array :[array_like]Input array or object whose elements, we need to test. axis : [i 3 min read
- numpy.invert() in Python numpy.invert() function is used to Compute the bit-wise Inversion of an array element-wise. It computes the bit-wise NOT of the underlying binary representation of the integers in the input arrays. For signed integer inputs, the two’s complement is returned. In a two’s-complement system negative num 2 min read
- numpy.asarray() in Python numpy.asarray()function is used when we want to convert input to an array. Input can be lists, lists of tuples, tuples, tuples of tuples, tuples of lists and arrays. Syntax : numpy.asarray(arr, dtype=None, order=None) Parameters : arr : [array_like] Input data, in any form that can be converted to a 2 min read
- numpy.multiply() in Python The numpy.multiply() is a numpy function in Python which is used to find element-wise multiplication of two arrays or scalar (single value). It returns the product of two input array element by element. Syntax: numpy.multiply(arr1, arr2, out=None, where=True, casting='same_kind', order='K', dtype=No 3 min read
- numpy.binary_repr() in Python numpy.binary_repr(number, width=None) function is used to represent binary form of the input number as a string. For negative numbers, if width is not given, a minus sign is added to the front. If width is given, the two’s complement of the number is returned, with respect to that width. In a two’s- 3 min read
- numpy.roll() in Python The numpy.roll() function rolls array elements along the specified axis. Basically what happens is that elements of the input array are being shifted. If an element is being rolled first to the last position, it is rolled back to the first position. Syntax : numpy.roll(array, shift, axis = None) Par 2 min read