pandas select group by select first row of each code example Example: select first row of every group pandas df.drop_duplicates(subset='A')