How to reverse the column order of the Pandas DataFrame? Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report Sometimes when working with DataFrames we might want to change or reverse the order of the column of the dataframe. In this article, let’s see how to reverse the order of the columns of a dataframe. This can be achieved in two ways – Method 1: The sequence of columns appearing in the dataframe can be reversed by using the attribute.columns[::-1] on the corresponding dataframe. It accesses the columns from the end and outer dataframe[…] reindexes the dataframe using this new sequence provided. Example: Python3 # importing required modulesimport pandas as pd dataframe = pd.DataFrame([[1, 'A', "Student"], [2, 'B', "Tutor"], [3, 'C', "Instructor"]]) print("Original DataFrame")display(dataframe) # reversing the dataframeprint("Reversed DataFrame")display(dataframe[dataframe.columns[::-1]]) Output: Method 2: iloc indexer can also be used to reverse the column order of the data frame, using the syntax iloc[:, ::-1] on the specified dataframe. The contents are not preserved in the original dataframe. Python3 # importing required modulesimport pandas as pd dataframe = pd.DataFrame([[1, 'A', "Student"], [2, 'B', "Tutor"], [3, 'C', "Instructor"]]) print("Original DataFrame")display(dataframe) # reversing the dataframeprint("Reversed DataFrame")display(dataframe.iloc[:, ::-1]) Output: Last Updated : 01 Jun, 2021 Like Article Save Article Previous Extract all capital words from Dataframe in Pandas Next Check if a column starts with given string in Pandas DataFrame? Share your thoughts in the comments Add Your Comment Please Login to comment...