Oct-14-2019, 11:04 AM
This is where we need to use data frame's groupby method. Look at the following minimal example and adopt it for your needs:
import pandas as pd df = pd.DataFrame({'x': ['one', 'one', 'two', 'three', 'three', 'three'], 'y': [1,2,3,4,5,6]}) df.groupby('x').sum()