Premium problem58. Flag Duplicate Rows by Subset

Medium Locked

Return a boolean Series, aligned to df's index, flagging rows that are duplicates of another row when considering only the club and age columns. For each set of duplicates, treat the last occurrence as the original (False) and flag all earlier occurrences as duplicates (True).

Input

  club  age name
0    A   24    P
1    A   24    Q
2    A   23    R
3    B   30    S
4    B   30    T

Output

0     True
1    False
2    False
3     True
4    False
dtype: bool

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)