← 30 Days of Python
Day 20 / 30Statistics

Descriptive Statistics

Statistics is the language of data. As an analyst, you do not need to be a statistician — but you must understand mean, median, variance, and distribution to communicate findings accurately.

1
Easy

What is the difference between mean and median, and when do you use each?

Python Answer
data = [10, 12, 11, 9, 100]  # outlier: 100

import statistics
statistics.mean(data)    # 28.4  — pulled up by outlier
statistics.median(data)  # 11.0  — not affected

# Pandas:
df["salary"].mean()
df["salary"].median()
💡

Mean is pulled by outliers. Median is robust. For salary, house prices, or any right-skewed distribution, median is more representative. Use mean when data is normally distributed. Report both in EDA.

2
Medium

What is standard deviation and what does it tell you?

Python Answer
import numpy as np

team_a = [50000, 55000, 48000, 52000]  # consistent
team_b = [20000, 90000, 30000, 80000]  # spread out

np.std(team_a)  # ~2550 — low spread
np.std(team_b)  # ~29000 — high spread
💡

Standard deviation measures how spread out values are around the mean. Low SD = consistent, predictable. High SD = high variability. Two teams can have the same mean salary but very different distributions — SD reveals this.

3
Easy

What are percentiles and quartiles?

Python Answer
df["salary"].quantile(0.25)  # Q1 — 25th percentile
df["salary"].quantile(0.50)  # Q2 — median
df["salary"].quantile(0.75)  # Q3 — 75th percentile
df["salary"].quantile(0.90)  # 90th percentile

# IQR:
IQR = df["salary"].quantile(0.75) - df["salary"].quantile(0.25)
💡

The 90th percentile means 90% of values fall below this point. Percentiles are used in salary benchmarking (P50, P75, P90 are standard), SLA reporting (99th percentile latency), and outlier detection.

4
Medium

What is skewness and how do you detect it?

Python Answer
df["salary"].skew()

# Interpretation:
# skew = 0     → symmetric (normal distribution)
# skew > 0     → right-skewed (tail on right — common for salary, price)
# skew < 0     → left-skewed (tail on left)

# Visualise:
sns.histplot(df["salary"], kde=True)
💡

Salary and revenue data are almost always right-skewed — most values cluster at the low end with a long tail of high earners. Log transformation can normalise right-skewed data for regression analysis.

5
Medium

How do you compute a frequency distribution and cumulative frequency?

Python Answer
# Frequency table:
freq = df["city"].value_counts()
freq_pct = df["city"].value_counts(normalize=True) * 100

# Cumulative:
freq_pct_cumulative = freq_pct.cumsum()
print(freq_pct_cumulative)
💡

normalize=True gives proportions. cumsum() gives cumulative proportions — useful for Pareto analysis: "the top 3 cities account for 80% of revenue." Pareto analysis is a common business insight in analytics interviews.

EVIKA ACADEMY · PYTHON FOR DATA ANALYTICS

Want to master Python with live practice?

Join our Python for Data Analysis course — live classes in Noida and online across India.

Book Free Demo Class →
← PREVIOUSDay 19: EDA — Exploratory Data Analysis WorkflowNEXT →Day 21: Correlation & Hypothesis Testing
Best Data Analytics Course in Noida Delhi NCR | EVIKA ACADEMY