Ravindra BagaleCourses & study guides मराठी Track your progress

17. Practice Exercises with Answer Hints

Data Science

17.2 GroupBy and Merge

Exercise C. GMV and order count by city for Delivered only. Named aggregations.

Hint C

Filter status first, then groupby("city", as_index=False).agg(gmv=("amount","sum"), orders=("order_id","nunique")).

Exercise D. Left-merge a stores table; list orders with missing city from the store dimension.

Hint D

orders.merge(stores, on="store_id", how="left") then df[df["city"].isna()].