python get one row of dataframe if duplicates code example Example: count duplicates in one column pandas df.pivot_table(index=['DataFrame Column'], aggfunc='size')