How would you manipulate data using SQL and Python?
Using the provided merchants, payments, and refunds tables, produce the requested January 2025 merchant-level results in PostgreSQL. Include merchants with no qualifying payment attempts. The SQL result should be reproducible in Python using equivalent tabular data manipulation.
Output
- One row per merchant, including merchants without January payment attempts
- Columns:
merchant_id, merchant_name, payment_attempts, successful_payments, captured_amount, refund_amount, net_amount, and success_rate_pct
- Include January payment activity and January refunds, order by
captured_amount descending, then merchant_id ascending