Spot anomalies in tabular data
Bad data hides in spreadsheets — a price typed with an extra zero, a sensor that spiked, a duplicated row. This tool reads a CSV, finds the numeric columns, and flags the values that sit far outside the rest of their column using one of two standard statistical methods: the IQR fence or the Z-score. Everything is computed locally, so you can vet a confidential dataset without uploading it.
How it works
The CSV is parsed in the browser (handling quoted fields and commas inside quotes). For each column the tool decides whether it is numeric by checking that most non-empty cells parse as numbers. Then:
- IQR method: the column is sorted, Q1 and Q3 are taken at the 25th and 75th
percentiles (linear interpolation), and
IQR = Q3 − Q1. A value is an outlier if it is belowQ1 − k·IQRor aboveQ3 + k·IQR. The multiplierkdefaults to1.5;3.0flags only extreme outliers. - Z-score method: the column’s mean
μand sample standard deviationσare computed, and each value’sz = (x − μ) / σ. A value is an outlier when|z|exceeds your threshold (default3).
Empty and non-numeric cells are ignored in the statistics and never flagged.
IQR versus Z-score: choosing the right method
The two methods have meaningfully different failure modes, and the right choice depends on the shape of your data.
IQR (interquartile range) is distribution-free. The quartiles it uses are medians of halves of the sorted data, so a single enormous outlier cannot drag them far from the bulk of the distribution. This makes IQR the more robust choice when the data is skewed, contains a few extreme values already, or when you have no reason to assume a bell-shaped distribution. Sales figures, pageview counts, and biological measurements are often right-skewed, and IQR handles them well.
Z-score assumes the column is roughly normally distributed. When that is true,
the standard deviation is a meaningful measure of spread, and flagging values more
than three sigma from the mean is a principled threshold. The weakness is
masking: if the column already contains a very large value, it inflates σ, and
the threshold widens enough to let genuinely outlying values pass unflagged. The
fix is to run both methods and compare.
Worked example
For a price column with values [9, 10, 11, 10, 9, 10, 11, 10, 10, 2500]:
- Q1 = 9.25, Q3 = 10.75, IQR = 1.5. The upper fence at
k=1.5is10.75 + 2.25 = 13. The value2500is flagged. - Mean ≈ 259, σ ≈ 774. Z-score of
2500is(2500 − 259) / 774 ≈ 2.9, which falls just under the default threshold of 3. The value is not flagged by Z-score — because the outlier itself inflated σ.
This is the classic masking effect. IQR catches the error; Z-score does not. Try both.
Adjusting sensitivity
The multiplier k in the IQR fence is adjustable:
k = 1.5— the standard “mild outlier” fence; flags data that is notably beyond the bulk.k = 3.0— the “extreme outlier” fence; flags only the most egregious values.
For the Z-score, a threshold of 3.0 corresponds to roughly the outermost 0.3% of a normal distribution. Raise it to 3.5 if you are getting too many false positives on a legitimately fat-tailed column, or lower it to 2.5 for tighter screening.
Tips and notes
- IQR is the safer default for skewed or heavy-tailed data because quartiles are not dragged around by the outliers themselves.
- With Z-score, a single huge value inflates
σand can hide smaller anomalies — if you suspect that, switch to IQR. - The bounds used for each column are shown so you can sanity-check whether the threshold matches your domain knowledge.
- Outliers are not always errors — they may be genuine high-value records, rare events, or edge cases worth investigating. Flagging is the first step; deciding whether to remove, correct, or keep them is a domain question.