How to drop duplicate columns of a pandas DataFrame in Python

Dropping duplicate columns removes all columns of the same name besides the first occurrence of the column.

Solution for How to drop duplicate columns of a pandas DataFrame in Python : You can use pandas.DataFrame.drop_duplicates() drop the duplicated rows Call pandas.DataFrame.T to transform the columns of a pandas.DataFrame to rows and vice-versa. Use pandas.DataFrame.drop_duplicates to drop duplicate rows (originally columns). Use pandas.DataFrame.T to transpose the pandas.DataFrame back to its original format.


how-to-drop-duplicate-columns-of-a-pandas-dataframe-in-python