Pandas → T-SQL › value_counts

Pandas value_counts to GROUP BY COUNT

The frequency table is the first report people ask for.

SELECT status, COUNT(*) AS n
FROM Orders
GROUP BY status
ORDER BY n DESC;

normalize=True is COUNT(*) * 1.0 / SUM(COUNT(*)) OVER ().

Canonical translation

SELECT status, COUNT(*) AS n
FROM Orders
GROUP BY status
ORDER BY n DESC;

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free