DEV Community

OOOOO
OOOOO

Posted on • Updated on

How to quickly delete duplicate rows in CSV, Excel, Markdown tables?

If you're working with CSV, Excel, or Markdown tables, you might run into duplicate rows. This could happen because you manually entered the same data more than once or imported duplicates from other sources. Whatever the reason, getting rid of duplicate rows is a key part of cleaning up your data. In this article, I'll show you a few quick ways to remove duplicate rows from CSV, Excel, and Markdown tables.

1. Online Table Tool [Recommended]

You can use an online tool called "TableConvert" to remove duplicate rows. This tool makes it super easy to check for and delete duplicates in CSV, Excel, and Markdown tables. Just open your browser and go to https://tableconvert.com/excel-to-excel. Paste or upload your data, then click the "Deduplicate" button in the Table Editor. It's that simple and quick! Check out the screenshot below:

Removing duplicate rows in CSV, Excel, Markdown tables

2. Removing Duplicate Rows in Excel

Getting rid of duplicate rows in Excel is super easy. First, open your Excel file and select the columns where you want to check for duplicates. Next, go to the "Data" menu and choose "Remove Duplicates." Excel will pop up a dialog box asking you to select the columns you want to check. Click "OK," and Excel will delete all the duplicate rows.

3. Removing Duplicate Rows in CSV with Python

If your data is in a CSV file, you can use Python to remove duplicate rows. First, you'll need to install the pandas library. Then, use the following code to read the CSV file and remove duplicates:



import pandas as pd

data = pd.read_csv("your_file.csv")
data = data.drop_duplicates()
data.to_csv("your_file.csv", index=False)


Enter fullscreen mode Exit fullscreen mode

This code will read your CSV file, remove the duplicate rows, and save the cleaned data back to the original file.

In summary, removing duplicate rows from CSV, Excel, and Markdown tables is an important data-cleaning task. By using the methods above, you can easily check for and delete duplicate rows, ensuring your data is accurate and useful.

Top comments (0)