A tiny shop sells pens, notebooks, mugs, tea, and coasters. Which product sells the most? Which category brings in the most money? Before answering, its CSV needs a little attention: a duplicated order, a missing quantity, a missing price, and an unnamed category.
This is a fictional dataset built for learning. We'll clean it with pandas, calculate revenue, and draw a Matplotlib chart. The screenshots show the script actually running in PythonIDE, which I build, on an iPhone 18 Pro simulator. They use development build 1.7.9 (4).
1. Give the mess a clear meaning
The example embeds CSV text so you can run one file without downloading anything. StringIO lets read_csv treat that text as a file. To use your own CSV later, replace that line with pd.read_csv('sales.csv').
Each order ID represents one line in this tiny dataset. Order 110 appears twice and should count once.…