Statistics for Data Science: The Complete Beginner’s Guide (2026)
You cannot do data science without statistics. You do not need a maths degree — you need the 20% of concepts that come up 80% of the time. This guide covers exactly that, with Python throughout.
Descriptive Statistics
import numpy as np
np.random.seed(42)
salaries = np.random.lognormal(mean=11, sigma=0.5, size=500)
print(f'Mean: {np.mean(salaries):,.0f}')
print(f'Median: {np.median(salaries):,.0f}')
print(f'Std: {np.std(salaries):,.0f}')
print(f'Q1/Q3: {np.percentile(salaries, 25):,.0f} / {np.percentile(salaries, 75):,.0f}')Mean greater than median signals right skew — exactly what you see in real salary data.
Key Probability Distributions
Normal — the bell curve; appears everywhere due to the Central Limit Theorem.
Binomial — counts of successes in n trials; models click-through and conversion rates.
Poisson — counts of events in fixed time; models server requests per second.
from scipy import stats
import matplotlib.pyplot as plt
fig, axes = plt.subplots(1, 3, figsize=(15,4))
x = np.linspace(40, 100, 200)
axes[0].plot(x, stats.norm.pdf(x, 70, 10)); axes[0].set_title('Normal')
k = np.arange(0, 60)
axes[1].bar(k, stats.binom.pmf(k, n=100, p=0.3), alpha=0.7); axes[1].set_title('Binomial')
k2 = np.arange(0, 20)
axes[2].bar(k2, stats.poisson.pmf(k2, mu=5), alpha=0.7, color='green'); axes[2].set_title('Poisson')
plt.tight_layout(); plt.show()Central Limit Theorem
The distribution of sample means approaches normal as n increases, regardless of the population’s distribution. This enables parametric tests even when underlying data is non-normal — as long as n is 30 or more.
Correlation vs Causation
import seaborn as sns
iris = sns.load_dataset('iris')
corr = iris.drop('species', axis=1).corr()
sns.heatmap(corr, annot=True, cmap='coolwarm', fmt='.2f', square=True)
plt.title('Iris Feature Correlations'); plt.show()High correlation does NOT mean causation. Ice cream sales and drowning rates correlate (both rise in summer) — the confounding variable is temperature.
Confidence Intervals
from scipy import stats
sample = np.random.choice(salaries, size=50)
ci = stats.t.interval(confidence=0.95, df=len(sample)-1,
loc=np.mean(sample), scale=stats.sem(sample))
print(f'95% CI: ({ci[0]:,.0f}, {ci[1]:,.0f})')P-values and Hypothesis Testing
The p-value is the probability of results at least as extreme as yours, assuming H0 is true. It is NOT the probability your hypothesis is true. p below 0.05 is statistically significant. Statistical significance is not the same as practical significance — always report effect sizes.
Type I error: rejecting a true null (false positive); probability = alpha.
Type II error: failing to reject a false null (false negative); power = 1 – beta.
Bayes Theorem
p_disease = 0.01
p_pos_given_disease = 0.99
p_pos_given_no_disease = 0.05
p_positive = p_pos_given_disease * p_disease + p_pos_given_no_disease * (1 - p_disease)
p_disease_given_pos = (p_pos_given_disease * p_disease) / p_positive
print(f'P(disease | positive): {p_disease_given_pos:.1%}') # ~16.6%Conclusion
Focus on distributions, hypothesis testing, confidence intervals, and the real meaning of p-values. Code these up in Python and you will build the intuition that textbook formulas alone cannot give you.



