Before this: Exact decimals for money
The idea
A huge sale may be a mistake or the best day of the year. Deleting it changes totals and hides the question. Flagging it keeps the data and asks for a decision.
Negative amounts are often legitimate: refunds, returns, corrections. Removing them or taking absolute values inflates revenue.
Write the rule as a flag column with a precise condition, and keep every row.
Worked example
Input: (sale, 1000.00) (sale, 10000.00) (refund, -25.00)
- Visual
Flag needs_review where amount > 5000.00
- SQL (DuckDB)
amount > 5000 AS needs_review
- pandas
df["needs_review"] = df["amount"] > Decimal("5000.00")
Result: 3 rows kept; only the 10000.00 sale is flagged
Common mistakes
- Deleting extremes.
- Capping values silently.
- Taking absolute values of refunds.
Check yourself
Should refunds be removed as negative outliers?
No. They are valid by the rules.
Practice it
Flag large transactions without removing any row.