Pandas → T-SQL › agg
Pandas agg to SQL aggregates
Several stats on one column are several functions, not a second pass.
SELECT SUM(total_amount) AS sum_amount,
AVG(total_amount) AS mean_amount,
COUNT(total_amount) AS count_amount
FROM Orders;
count in pandas skips NA. COUNT(col) does the same. COUNT(*) counts the row.
Canonical translation
SELECT SUM(total_amount) AS sum_amount,
AVG(total_amount) AS mean_amount,
COUNT(total_amount) AS count_amount
FROM Orders;
Then write it on a ticket
Monday is free. A colleague asks, you type, we mark it.
Clock in free