Answers for "python dataframe delete duplicate rows and compute count"

11

remove duplicate row in df

df = df.drop_duplicates()
Posted by: Guest on August-19-2020
1

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)
Posted by: Guest on December-17-2021

Code answers related to "python dataframe delete duplicate rows and compute count"

Python Answers by Framework

Browse Popular Code Answers by Language