Dataframe grouping problem

clipboard.png
when grouping in the first step, I want to take only the top 10 of each group for mean and sun operations

Aug.17,2021

    http_df.sort_values(['dst_ip', 'req_hdr_l'], ascending=[1, 0], inplace=True)
    tmp_df = http_df[['dst_ip', 'req_hdr_l']].groupby(['dst_ip']).head(20).groupby(['dst_ip'])['req_hdr_l'].agg(['mean', 'sum']).reset_index()
    tmp_df.columns = ['dst_ip', 'req_hdr_l_stats_[av/dst]', 'req hdr_l_stats[sum/dst]']
    http_df = pd.merge(tmp_df, http_df, how='right', on='dst_ip')
    
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5436e-4529b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5436e-4529b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?