Real CSV files have quoted fields with commas in them, blank lines and the occasional broken row. Splitting on commas yourself breaks on all of these. Use the csv module.
Implement sales_report(text) where text is CSV with a header row category,item,amount:
amount per category. Amounts may be written like 1,250.50 inside quotes, so remove the commas.{"totals": {category: total}, "skipped": n}, with totals rounded to 2 decimal places and categories sorted alphabetically.