Is there a way to grab the last item of a group
groupby
/tail
df.groupby('Column 1').tail(1)
Column 1 Column 2 Column 3
1 1 2 2
4 2 3 3
5 3 1 6
9 4 4 5
Use Groupby.nth
:
In [198]: df.groupby('Column 1', as_index=False).nth([-1])
Out[198]:
Column 1 Column 2 Column 3
1 1 2 2
4 2 3 3
5 3 1 6
9 4 4 5
Use drop_duplicates
df_final = df.drop_duplicates('Column 1', keep='last')
Out[9]:
Column 1 Column 2 Column 3
1 1 2 2
4 2 3 3
5 3 1 6
9 4 4 5