Skewness & Kurtosis
Describe asymmetry and tail heaviness to choose transforms and model assumptions wisely.
In plain words
Skewness tells you whether a long tail stretches to the right or left; kurtosis tells you how extreme the extreme values tend to be.
Think of it like…
Skewness is which way a seesaw's load leans, with a long thin plank sticking out one side. Kurtosis is how many heavy weights sit far out on the planks, beyond what a bell-shaped load would put there.
Where you’ve seen it
Order values in an e-commerce dataset have mean ₹1,850, median ₹1,100, skewness 3.2 and excess kurtosis 18, with a handful of bulk orders above ₹50,000. A linear regression on raw order value has residuals dominated by those orders. After np.log1p(order_value) the skewness is 0.4 and excess kurtosis 0.9 (illustrative values), residuals look roughly symmetric, and predictions are far more stable; the team reports medians and percentiles instead of the mean in dashboards.
Words you’ll hear
- Skewness
- Standardised third moment: sign gives the tail direction, size the asymmetry.
- Excess kurtosis
- Kurtosis minus 3; positive means heavier tails than a normal distribution.
- Heavy tails
- A higher-than-normal chance of extreme values.
- Transformation
- A function (log, sqrt, Box-Cox, Yeo-Johnson) applied to reduce skew.
Visual diagram
Theory & deep dive
Reading skewness and kurtosis
Skewness near 0 (say |skew| < 0.5) is roughly symmetric; 0.5 to 1 is moderately skewed; above 1 in absolute value is strongly skewed. In right-skewed data the mean exceeds the median. A normal distribution has skewness 0 and excess kurtosis 0; a uniform distribution has excess kurtosis −1.2 (light tails); a Laplace or Student's t with few degrees of freedom has positive excess kurtosis (heavy tails). Different software reports kurtosis differently: Pearson's definition has normal = 3, the Fisher (excess) version used by pandas and scipy.stats.kurtosis has normal = 0, so always check which is reported.
These statistics depend on third and fourth powers, so a single extreme value can dominate them and small samples give unreliable estimates; always look at the histogram or a Q-Q plot too. Heavy tails matter for risk: in a normal distribution a 5-standard-deviation move is vanishingly rare, but in heavy-tailed financial or transaction data it happens regularly.
df["amount"].agg(["mean", "median", "skew", "kurt"]) shows mean 1,850, median 1,100, skew 3.2, kurt 18, which is a strong signal to transform or use robust methods.
What to do about skew and heavy tails
For right-skewed positive data, a log transform (np.log1p handles zeros) often yields near-symmetric data and turns multiplicative effects into additive ones; sqrt is milder. Box-Cox (positive data) and Yeo-Johnson (any real values) pick a power transform automatically (sklearn.preprocessing.PowerTransformer). For left skew, reflect the variable or use powers above 1. After transforming, re-check skewness and interpret results back on the original scale (a log model's coefficients are approximately percentage effects).
Transformations aren't always the answer: tree-based models are insensitive to monotonic transformations of features; for the target, a transform changes what the loss measures; and for business reporting, medians, percentiles and trimmed means are easier to explain. For heavy tails, consider robust losses (Huber, quantile), winsorising extreme values at percentiles, modelling tails separately (extreme value theory), and bootstrapped intervals rather than normal-theory ones. Document any transformation so predictions can be inverted correctly.
Pipeline([("pt", PowerTransformer(method="yeo-johnson")), ("lr", LinearRegression())]) learns the transform on training data only, applies it to new data, and handles zeros and negatives.
How it works, step by step
Step 1 of 41. Plot and measure
Draw a histogram or Q-Q plot and compute skew and kurtosis, noting which kurtosis definition is used.
- Compare
- mean vs median
When to use it & trade-offs
What it is
Skewness measures asymmetry of a distribution: positive (right-skewed) means a long tail of large values, negative means a long tail of small values, and 0 means symmetric. Kurtosis measures tail weight relative to a normal distribution: excess kurtosis (kurtosis − 3) above 0 means heavier tails and more extreme values than a normal, below 0 means lighter tails. Both are computed from standardised third and fourth moments, and pandas reports them as s.skew() and s.kurt() (excess, bias-corrected). They guide transformations and the choice of models and tests.
Why it matters: Income, prices, durations and counts are typically right-skewed with heavy tails: means mislead, linear models fit poorly, outliers dominate squared-error losses and normal-theory intervals understate risk. Seeing skewness and kurtosis early tells you when to log-transform, use robust methods or model the tails explicitly, and warns that "a few standard deviations" is not a safe bound.
When to reach for it
- Deciding whether to transform features or targets
- Choosing mean vs median for reports
- Spotting heavy-tailed risk in financial or transaction data
When to avoid or be careful
- Applying log to zeros or negatives
- Trusting skew and kurtosis from tiny samples
- Fitting transformation parameters on test data
Handling skewed data
Strengths: Simple; interpretable multiplicative effects.
Watch out: Needs positive values; changes interpretation.
Strengths: Data-driven; Yeo-Johnson handles zeros and negatives.
Watch out: Less interpretable; fitted parameters to store.
Strengths: Resistant to outliers; no transform needed.
Watch out: May need specialised methods.
Interview signals & numbers to know
When this topic comes up
- “The residuals are skewed”
- “Mean is far above the median”
- “Should I log-transform this feature?”
- Heavy-tailed risk
- Box-Cox and Yeo-Johnson
Benchmarks & rules of thumb
- 0
- skewness and excess kurtosis of a normal distribution
- −1.2
- excess kurtosis of a uniform distribution
- 3
- Pearson kurtosis of a normal distribution
Common mistakes & follow-ups
Common interview mistakes
- Comparing a pandas kurtosis of 0.5 with a textbook value of 3.5 and thinking they disagree.
- Log-transforming a column with zeros and getting -inf.
- Assuming a normal distribution's tail probabilities for heavy-tailed transaction data.
Likely interviewer follow-ups
- What does positive skewness tell you about mean and median?
- What is excess kurtosis and why does it matter for risk?
- When does a log transform help and when doesn't it?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply Skewness & Kurtosis with data science interview Q&A and hands-on practice.