tiru
tiru

Reputation: 363

how to remove duplicates if two columns are equal

dataframe is

View              player  country
Admin_Case_View  ckear    USA
Admin_Case_View  ckear  
Admin_Case_View  ckear  
Admin_Questions  jungeunk  KOR
Admin_Questions  jungeunk   

if view == player , then remove duplicates and where place is empty in country column.

required output should be

View              player  country
Admin_Case_View  ckear    USA   
Admin_Questions  jungeunk  KOR

Upvotes: 0

Views: 46

Answers (1)

vlizana
vlizana

Reputation: 3232

Something like

df.dropna(subset=['country']).drop_duplicates(subset=['View', 'player'])

should do the trick if I understood correctly.

Upvotes: 1

Related Questions