Category : pandas-groupby

I would like the following code to run faster (maybe using numpy ?) but I can’t figure out how to do it : df = df[[‘shop_id’, ‘brand’, ‘industry’, ‘zip_code’, ‘impressions’, ‘is_retailer’]].groupby( [‘shop_id’, ‘zip_code’, ‘brand’]).agg( {‘impressions’: ‘sum’, ‘is_retailer’: ‘sum’, ‘industry’: ‘max’}).reset_index() Basically, I want to group by a dataframe by shop_id, zip_code and brand, and perform ..

Read more