Create Country-Level Spend Report Using Pandas
Company: Amazon
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates proficiency in data manipulation using pandas, including relational joins and aggregation to produce country-level summary statistics like totals and averages.
Tables
users(user_id INTEGER, country VARCHAR(2))
transactions(txn_id INTEGER, user_id INTEGER, amount DECIMAL(10,2))
Hints
- Use an INNER JOIN on users.user_id = transactions.user_id to keep only matching rows.
- Group by u.country and compute SUM(t.amount) and AVG(t.amount).