Statistics Notes for Data Science

By Vaibhav Gupta | July 14, 2026 | Free Resource

Table of Contents

1. Descriptive Statistics

Measures of Central Tendency

  • Mean: Average of all values
  • Median: Middle value when sorted
  • Mode: Most frequent value

Measures of Dispersion

  • Range: Max - Min
  • Variance: Average squared deviation from mean
  • Standard Deviation: Square root of variance
  • IQR: Q3 - Q1 (middle 50%)
import numpy as np

data = [10, 20, 30, 40, 50]

# Mean
mean = np.mean(data)  # 30

# Median
median = np.median(data)  # 30

# Standard Deviation
std = np.std(data)  # 14.14

# Variance
var = np.var(data)  # 200

2. Probability

Basic Concepts

  • Event: Outcome of an experiment
  • Sample Space: Set of all possible outcomes
  • Probability: Number of favorable outcomes / Total outcomes

Bayes' Theorem

P(A|B) = P(B|A) * P(A) / P(B)

# Example: Medical Test
# P(Disease) = 0.01
# P(Positive|Disease) = 0.99
# P(Positive|No Disease) = 0.05

# P(Disease|Positive) = ?
P_disease = 0.01
P_positive_given_disease = 0.99
P_positive_given_no_disease = 0.05

P_positive = P_positive_given_disease * P_disease +              P_positive_given_no_disease * (1 - P_disease)

P_disease_given_positive = (P_positive_given_disease * P_disease) / P_positive
print(P_disease_given_positive)  # 0.167

3. Distributions

Normal Distribution

  • Bell-shaped curve
  • Mean = Median = Mode
  • 68% within 1 SD, 95% within 2 SD, 99.7% within 3 SD

Binomial Distribution

  • Two outcomes: success/failure
  • Fixed number of trials
  • Independent trials

4. Hypothesis Testing

Steps

  1. State null and alternative hypotheses
  2. Choose significance level (α = 0.05)
  3. Calculate test statistic
  4. Find p-value
  5. Make decision (reject or fail to reject H0)

Types of Tests

  • t-test: Compare means of two groups
  • chi-square: Test independence of categorical variables
  • ANOVA: Compare means of three or more groups

5. Correlation

import pandas as pd

# Correlation matrix
df = pd.DataFrame({
    'hours_studied': [1, 2, 3, 4, 5],
    'marks': [10, 20, 30, 40, 50]
})

correlation = df.corr()
print(correlation)

Correlation vs Causation

Correlation does not imply causation. Two variables can be correlated without one causing the other.

Download Statistics Notes PDF

Get the complete Statistics Notes as a free PDF. Enter your email to receive the download link.

Start Learning with DSWallah

Join 300+ students who transformed their careers with DSWallah. IIT-certified mentor, 50+ real projects, placement support.

WhatsApp for Free Demo →