Premium problem109. Total Order Cost per Customer

Easy Locked

customers has columns customer_id and first_name. orders has columns order_id, customer_id and total_order_cost.

Return a DataFrame with columns customer_id, first_name and total_order_cost giving each customer's total spend. Customers with no orders are left out. Sort by first_name alphabetically and renumber the index from 0.

Input

customers =
   customer_id first_name
0            1        Zoe
1            2        Ann
2            3         Bo
orders =
   order_id  customer_id  total_order_cost
0         1            1              10.0
1         2            1              15.0
2         3            2               7.0
3         4            2               3.0

Output

   customer_id first_name  total_order_cost
0            2        Ann              10.0
1            1        Zoe              25.0

Premium problem

This one's part of Premium. Unlock the full Pandas track plus every other premium problem on the site.

Implement solve(...)