[英]GroupBy Dataframe by one column and get count based on another column
[英]How to sort index with groupby based on another column count
我想通了,with.join function
x = WMS_missing.join(WMS_missing.groupby('level_3')['LHR Item Count'].count(), on='level_3', rsuffix='_r')
z = x.groupby('level_3')
z.apply(lambda df: df.reset_index(drop=True)).sort_values(by='LHR Item Count_r', ascending=False)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.