Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

remove duplicates in dataframe by index python

# Remove by index
df = df[df.index.duplicated(keep='first')]

# Other methods to remove duplicates
import pandas as pd

df = df.drop_duplicates()

df = df.drop_duplicates(subset = "column")

df = df.drop_duplicates(subset = ["column", "column2"])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #duplicates #dataframe #index #python
ADD COMMENT
Topic
Name
5+8 =