Answers for "dataframe without duplicates for one column"

2

remove duplicates based on two columns in dataframe

df.drop_duplicates(['A','B'],keep= 'last')
Posted by: Guest on August-13-2020
0

keep only one duplicate in pandas

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 March-03-2021

Code answers related to "dataframe without duplicates for one column"

Python Answers by Framework

Browse Popular Code Answers by Language