0

I have a dataframe "df" like the sample below. I would like to use address and business_id as a unique key, and filter the dataframe so it only has unique records based on the combination of address and business_id. Can anyone suggest how to do that?

Code:

print df[["address","business_id","city"]][1:3]

Sample Data:

               address             business_id       city
1       2824 Milton Rd  mLwM-h2YhXl2NCgdS84_Bw  Charlotte
2  337 Danforth Avenue  v2WhjAB3PIBA8J8VxG3wEg    Toronto
user3476463
  • 3,967
  • 22
  • 57
  • 117

1 Answers1

-1

Along with removing the duplicate, you want to use df.set_index

df.set_index(keys=["address","business_id"])
Mikell-S
  • 42
  • 3