Pandas — The Ultimate Guide for Data Analysis
The most tested Python library in every data analyst interview. Master DataFrames, groupby, merging, and pivot tables to handle any real-world dataset with confidence.
These six areas cover 95% of Pandas questions asked at UK and Indian data analyst interviews in 2026.
Series & DataFrame
The two core structures. A Series is a 1D labelled array; a DataFrame is a 2D table — like a SQL table or Excel sheet.
- Creating from dict, list, CSV
- Index vs columns
- dtypes and memory usage
Selecting & Filtering
loc vs iloc, boolean masks, query() — the most common follow-up after “load this CSV”. Get this wrong and interviews end early.
- df.loc[] label-based selection
- Boolean masks with & and |
- isin() and between()
GroupBy & Aggregation
Split-apply-combine — the Pandas equivalent of SQL GROUP BY. Tested in 90% of data analyst interviews.
- Named aggregations (modern style)
- transform vs apply
- Multi-column groupby
Merging & Joining
merge(), join(), concat() — handle multiple tables just like SQL joins. A frequent live-coding task.
- inner, left, right, outer joins
- on vs left_on / right_on
- Handling duplicate key columns
Missing Data
isna(), fillna(), dropna() — every real dataset has nulls. Interviewers test whether you treat them thoughtfully.
- Detecting and counting nulls
- Mean / median imputation
- Forward fill for time series
Pivot & Reshape
pivot_table(), melt(), stack/unstack — reshape long-to-wide and back. Standard in case study rounds.
- pivot_table with aggfunc
- melt() for unpivoting
- crosstab for frequency tables
The classic groupby question. Named aggregations show you write modern, readable Pandas.
Tests pivot_table, datetime parsing, and pct_change in one question.
Actual questions with model answers — from interviews at top UK and Indian companies.
The methods that appear again and again in interviews.
| Method | Purpose |
|---|---|
| df.head(n) / tail(n) | Inspect first or last n rows |
| df.info() / describe() | Schema overview and summary stats |
| df.loc[] / df.iloc[] | Label-based vs position-based selection |
| df.groupby().agg() | Split-apply-combine aggregation |
| pd.merge(a, b, how, on) | Join two DataFrames like SQL |
| pd.concat([a, b], axis) | Stack DataFrames row- or column-wise |
| df.pivot_table() | Wide-format aggregated summary |
| df.fillna() / dropna() | Handle missing values |
| df.sort_values(col) | Sort rows by column(s) |
| df.value_counts() | Count unique categorical values |
| df.drop_duplicates() | Remove duplicate rows |
| df.to_csv() / to_excel() | Export to file |
Ready to ace your Pandas interview?
Book a free 30-minute mock and get real Pandas problems with live expert feedback.
Book Free Pandas Session