Pandas → T-SQL › nunique
Pandas nunique to COUNT DISTINCT
How many different customers ordered? COUNT(DISTINCT customer_id).
SELECT COUNT(DISTINCT customer_id) FROM Orders;
SELECT status, COUNT(DISTINCT customer_id) AS customers
FROM Orders
GROUP BY status;
COUNT(DISTINCT) ignores NULL. pandas nunique drops NA by default too.
Canonical translation
SELECT COUNT(DISTINCT customer_id) FROM Orders;
SELECT status, COUNT(DISTINCT customer_id) AS customers
FROM Orders
GROUP BY status;
Then write it on a ticket
Monday is free. A colleague asks, you type, we mark it.
Clock in free