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.
What is the difference between mean and median, and when do you use each?
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.
What is standard deviation and what does it tell you?
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 spreadStandard 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.
What are percentiles and quartiles?
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.
What is skewness and how do you detect it?
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.
How do you compute a frequency distribution and cumulative frequency?
# 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 →