Aug-24-2019, 03:15 AM
I think the following example should help you:
Hope the following will work:
df = pd.DataFrame({'x': [3,3,0,0,0,1,2,1], 'y': [10,10,10,11,11,3,3,3], 'z':['a', 'a', 'a', 'a', 'b', 'b','b', 'b']}) df.groupby(['y', 'z']).x.min().reset_index()Note, you should be sure that the datetime column is of 'date'-type (not a string).
Hope the following will work:
df.groupby(['NO', 'COURSE_YEAR'])['datetime'].min().reset_index()