25. How to Rank and Running Totals in pandas (rank, cumsum, window)
Chala mitrano, groupby ne city totals dile — pan manager vicharto “Pune madhe konta order top?”, “Diwali week cha running GMV?”. Aaj rank, cumsum, ani thoda window (rolling / expanding). Model nahi. Copy-paste lab aahe.
What you will learn in this chapter
- Why ranks and running totals beat a raw sorted dump
rankmethods (average, dense, min) in plain Englishcumsumfor day-by-day and city running GMV- Group-wise rank and cumsum (
.groupby(...).rank/.cumsum) - Light windows:
rollingandexpandingmeans - Common mistakes: unsorted dates, wrong group keys
- A Blinkit Maharashtra practice lab
Fictional data
Blinkit / Amazon Now figures in this chapter are fictional sample data for learning only. They do not show real company numbers. People names are for practice; e-mails use example.com.
Concepts in this chapter
- 25.1Why Rank and Running Totals
- 25.2rank: Place Among Peers
- 25.3cumsum: Running Totals
- 25.4Group-wise Rank and Cumsum
- 25.5Light Windows: rolling and expanding
- 25.6Common Mistakes
- 25.7Practice, Tip and Close
The chapter recap is at the end of the last concept page.