return just one row of dataframe groupby code example Example: dataframe, groupby, select one df.sort_values('date').groupby(['id', 'period', 'type']).first()