Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dataframe delete duplicate rows with same column value

df = df.drop_duplicates(subset=['Column1', 'Column2'], keep='first')

# Exemple
import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dataframe #delete #duplicate #rows #column
ADD COMMENT
Topic
Name
1+4 =