0

First, sorry for the unclear title. But I couldn't think of anything else at this point of time. Suppose i have the data similar to following-

Name    Type    Year
ABC     ABC-1   2000
ABC     ABC-1   2001
ABC     ABC-1   2002
ABC     ABC-2   2000
ABC     ABC-2   2002
DEF     DEF-1   2001
DEF     DEF-1   2002
DEF     DEF-2   2000
DEF     DEF-2   2001
DEF     DEF-3   2004

Now I don't want to bother about the year variable. I want the data to be of the following form-

Expected Format

Name    Type
ABC     ABC-1
ABC     ABC-2
DEF     DEF-1
DEF     DEF-2
DEF     DEF-3

I tried some combination of table, ftable. But I can't get them as I want. Can you guys help me? Thanks !!

Community
  • 1
  • 1
madmathguy
  • 23
  • 1
  • 7

1 Answers1

0

We can use duplicated

df[!duplicated(df[1:2]),-3]
#  Name  Type
#1   ABC ABC-1
#4   ABC ABC-2
#6   DEF DEF-1
#8   DEF DEF-2
#10  DEF DEF-3
akrun
  • 874,273
  • 37
  • 540
  • 662