Descriptive Statistics in Python
Calculate mean, median, mode, variance, standard deviation and percentiles with pandas
Descriptive statistics summarise a dataset — central tendency (what is typical?), spread (how varied?), and shape (symmetric or skewed?). Every EDA and analyst report starts with these.
pandas and NumPy make these trivial to calculate on any column. Understanding when to use mean vs median — and why standard deviation matters — is what separates analysts from people who just run the formulas.
Example
Key Points
- ✓Use median for skewed data (salary, house price, revenue) — mean is misleading with outliers
- ✓Standard deviation tells you spread — 68% of normal data falls within 1 std dev of mean
- ✓df.describe() gives count, mean, std, min, 25%, 50%, 75%, max in one call
- ✓Skewness: mean > median = right-skewed (tail on right); mean < median = left-skewed
- ✓For categorical columns: value_counts() is the equivalent of descriptive stats
Practice Question
A dataset of employee salaries has mean ₹85,000 but median ₹55,000. What does this tell you?