详细题解 | #双11购物节的销冠#
双11购物节的销冠
https://www.nowcoder.com/practice/830250e46b124c93b3431e0acfa95606
import pandas as pd data = pd.read_csv('Order.csv',sep=',') data = data.groupby('shop_name')['price'].agg(['sum']) # 先按'shop_name'分组,计算每一组的'price'的总数(多出列名为'sum'的列) print(data.sort_values('sum', ascending=False)) # 按'sum'降序排列,默认为升序