Answers for "drop duplicates pandas multiple columns"

2

remove duplicates based on two columns in dataframe

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

pd.merge duplicate columns remove

#Create test data
df1 = pd.DataFrame(np.random.randint(100,size=(1000, 3)),columns=['A','B','C'])
df2 = pd.DataFrame(np.random.randint(100,size=(1000, 3)),columns=['B','C','D'])

pd.merge(df1, df2, how='inner', left_on=['B','C'], right_on=['B','C'])
Posted by: Guest on July-07-2021

Code answers related to "drop duplicates pandas multiple columns"

Python Answers by Framework

Browse Popular Code Answers by Language