I have a dataframe like this :
id values
0 1 3
1 1 6
2 1 3
3 2 7
4 2 6
5 2 3
6 2 9
And I want to delete the first line of each group based on id
,the result should like this:
id values
1 1 6
2 1 3
4 2 6
5 2 3
6 2 9
I tried it done by: df = df.groupby('id').agg(lambda x:x[1:])
,but it doesn't work.
Can someone help me?Thanks in advance