Data Frame is:
df=pd.DataFrame([[1,'a',30],[1,'b',60],[1,'b',40],[2,'g',40],[2,'g',9],[3,'k',20],[3,'k',69],[3,'k',29],[3,'f',99]], columns = ['Lot','Item','Date'])
Lot Item Date
0 1 a 30
1 1 b 60
2 1 b 40
3 2 g 40
4 2 g 9
5 3 k 20
6 3 k 69
7 3 k 29
8 3 f 99
I need to
- Group By Lot and then Item
- Get the First Item in each Lot
- Finally Get the Max Date for each First Item GROUP in Each Lot
The OUTPUT should be:
Lot Item Date
0 1 a 30
3 2 g 40
6 3 k 69
Thank you !!!