The orders table contains order rows by customer.
Return one row with returning_customers, total_customers, and returning_rate, where returning customers have more than one order and the rate is a percentage rounded to 2 decimal places.
These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].
orders10 rows| order_id (int) | customer_id (int) |
|---|---|
| 1 | 101 |
| 2 | 101 |
| 3 | 101 |
| 4 | 102 |
| 5 | 103 |
| 6 | 103 |
| 7 | 104 |
| 8 | 105 |
| 9 | 105 |
| 10 | 105 |
Column names and order must match. Sort order is specified in the question.