Hello geeks and welcome in this article, we will cover NumPy fliplr. Along with that, we will also look at its syntax and parameters. To make the topic crystal clear, we will also look at a couple of examples. But at first, let us try to understand NumPy.fliplr() through its definition. Suppose you have a matrix with you. A demand arrives where you need to flip the entries in each row with the column being preserved. This function will come in handy in this situation, and you can achieve it with just a single line of code. Now moving ahead, we will look at its syntax, followed by parameters.

Contents of Tutorial


Given below is the general syntax for this function


A relatively simple syntax when compared to other functions of NumPy. It has only one parameter associated with it that we will be discussing next.


M: array_like

It represents the input array over which the operation needs to be performed. The input array must be at least 2-dimensional for this function to work. For a 1-d array, you can use another function called numpy. flipud().



It returns an output array with the columns reversed . Since the operation is returned the operation is O(1).

Now with the syntax and parameters being done. Let us look at couple of examples that help us in understanding the concept better.


import numpy as ppool


[[23  1]
 [ 6 34]]

Above, we can see the straightforward example of NumPy fliplr. In the above example, we have first imported the NumPy module. Following this, we have defined a 2-dimensional array. In the last line of our code, we have used the print statement. Our output justifies our input and our function. We get [23,1] which reverse of [1,23] and [6,34] reverse of [34,6]. Here we can see the same row elements are flipped while the shape of the array is preserved.

Now let us look another example with a 3-dimensional matrix.

import numpy as ppool


[[3 2 1]
 [6 5 4]
 [9 8 7]]

In the above example, the only difference is that we have used a 3-d array. We have first imported the NumPy module. Following which we have defined our array and then used a print statement to get our desired output. Here we can see that again, and the values are switched from left to right. At the same time, the shape of the array is still maintained. Here we can see the position of the middle element remains unchanged.


In this section, we will be comparing two of the NumPy function and the basic differences between them. As stated above we know that the fliplr() function is used to flip the array from left to the right direction. On contrary, the flipud() function is used to shift the function from up to down.

Now let us look at the effect of the function on a similar array.

fliplr() flipud()
import numpy as ppool
import numpy as ppool
[[2 1]
[4 3]]
[[3 4]
[1 2]]
Comparison table

From the above table we can draw conclusion. Also we can spot the basic difference between the 2 function.



In this article, we covered NumPy fliplr. Along with that, we looked at its syntax and parameters. For a better understanding, we looked at a couple of examples. In the end, we can conclude that NumPy.fliplr() is used to shift the array left to right with preserving the shape of the array. I hope this article can clear all of your doubts and make this topic crystal clear to you. If you still have any unsolved queries or doubts, feel free to write them below in the comment section. Done reading this, why not read NumPy vstack next.

Author: Shantun Parmar


  1. I happen to be writing to make you understand of the helpful encounter my friend’s daughter found reading through your web page. She figured out numerous issues, not to mention what it’s like to have an amazing giving mood to have most people really easily know selected impossible subject areas. You really exceeded our own expectations. Many thanks for imparting the interesting, safe, explanatory and even easy thoughts on the topic to Janet.

  2. I precisely needed to appreciate you once again. I am not sure the things that I might have gone through in the absence of the entire opinions documented by you directly on such a industry. It had been a very fearsome difficulty in my circumstances, however , finding out the skilled manner you managed that made me to jump over fulfillment. I am happier for this help and even hope you find out what a great job you are doing instructing other individuals through the use of your site. I know that you have never encountered all of us.

  3. I am just writing to make you understand what a really good experience my wife’s princess obtained using your webblog. She noticed some things, which included what it is like to possess an excellent teaching spirit to make others with no trouble learn about specific tortuous things. You undoubtedly surpassed readers’ expected results. Thanks for providing those productive, trusted, informative as well as unique tips on your topic to Mary.

  4. Medication prescribing information. Drug Class. can i get generic viagra without rx in Canada. Actual trends of medication. Get now.
    [url=]Some news about pills.[/url] [url=]All trends of medication.[/url] [url=]Some trends of drug.[/url] 8dfd203

Thanks for your support, You may click on ads to encourage us which assits to writers.

Leave a Reply

Your email address will not be published.