Python agregation function

  data-analysis, python

I need to modify my code:

db_profit_platform=db[['Source','Device','Country','Profit']]
db_profit_final=db_profit_platform.groupby(['Source','Device','Country'])['Profit'].apply(sum).reset_index()

Now I need to add Bid and get average bid after group by (different aggregations for different columns):
to get: Source Device Country SumProfit Average Bid

How can I do it? (and maybe I will need more aggregations) Thanks

Source: Python Questions

LEAVE A COMMENT