Store total qty per city and category in result (columns city, category, qty).
import pandas as pd
orders = pd.DataFrame({
"order_id": [101, 102, 103, 104, 105, 106, 107, 108, 109, 110],
"customer": ["Asha", "Ravi", "Asha", "Kiran", "Meena", "Ravi", "Om", "Asha", "Kiran", "Farah"],
"city": ["Pune", "Delhi", "Pune", "Mumbai", "Pune", "Delhi", "Mumbai", "Pune", "Mumbai", "Delhi"],
"category": ["Electronics", "Fashion", "Fashion", "Home", "Electronics", "Electronics", "Home", "Home", "Fashion", "Fashion"],
"amount": [2499, 799, 1599, 3499, 4999, 1299, 399, 899, 2999, 499],
"qty": [1, 2, 1, 1, 1, 3, 4, 2, 1, 5],
"date": pd.to_datetime(["2025-01-05", "2025-01-12", "2025-02-03", "2025-02-14", "2025-02-28",
"2025-03-09", "2025-03-15", "2025-03-22", "2025-04-02", "2025-04-18"]),
})Store your final answer in a variable named result.
Run your code to see the output here.