Paid and total orders per customer
Your task
Given orders with columns order_id, customer, amount, status and placed, return per customer the count of paid orders as paid and the count of all their orders as total. Every customer appears, even with zero paid. Sort by customer ascending.
Examples
order_mix(orders: dataframe) -> dataframeExample 1
Input
order_mix(orders)orders
| order_id | customer | amount | status | placed |
|---|---|---|---|---|
| 1 | ada | 120.5 | paid | 2024-01-05 |
| 2 | bo | 80 | refunded | 2024-01-07 |
| 3 | ada | 45.25 | paid | 2024-02-11 |
| 4 | cy | 200 | paid | 2024-02-14 |
| 5 | bo | 15.75 | pending | 2024-03-02 |
| 6 | ada | 60 | paid | 2024-03-19 |
Output
| customer | paid | total |
|---|---|---|
| ada | 3 | 3 |
| bo | 0 | 2 |
| cy | 1 | 1 |