Python dành cho người dùng bảng tính
Chris Cardillo
Data Scientist
fruit_sales.groupby('store', as_index=False).mean()


totals = fruit_sales.groupby(['store', 'product_name'], as_index=False).sum()

totals = (totals.sort_values('revenue', ascending=False)
.reset_index(drop=True))

top_store_sellers = totals.groupby('store').head(1).reset_index(drop=True)

# Dữ liệu gốc
fruit_sales
# Tóm tắt - theo trái cây và cửa hàng
totals = fruit_sales.groupby(['store', 'product_name'], as_index=False).sum()
# Sắp xếp bản tóm tắt
totals = (totals.sort_values('revenue', ascending=False)
.reset_index(drop=True))
# Dòng đầu cho mỗi cửa hàng
top_store_sellers = totals.groupby('store').head(1).reset_index(drop=True)







Python dành cho người dùng bảng tính