how to merge rows in a dataframe in python code example Example: how to merge rows in pandas dataframe df = dataframe.groupby(['date', 'sitename', 'name']).sum()