Remove Duplicate Rows in a Pandas DataFrame

By Hemanta Sundaray on 2021-08-08

Let’s read the budget.xlsx file into a DataFrame.

import pandas as pd

budget = pd.read_excel("budget.xlsx")

budget

Output:

Budget

We can see that we have duplicate rows in our DataFrame.

We can remove them using the drop_duplicates() method.

budget.drop_duplicates(inplace = True)

budget

Output:

Duplicate Rows Removed

The duplicate rows have been removed.

Learn how to find duplicate rows in a pandas DataFrame in my blog post here.

Join the Newsletter