import smart.top import pandas as pd df = pd.DataFrame (smart.top.read(name='firefox,code')) print (df.groupby(['user'])['cpu','mem'].sum())