HomebaseWorks

Data analysis (Pandas) interview questions

Questions interviewers commonly ask analysts about pandas, with answers that show how you actually work with data.

EWritten by the HomebaseWorks editorial team · reviewed 26 Oct 2026
1
What is the difference between loc and iloc?

loc selects by index labels and column names, and its slices include the end label. iloc selects by integer position and excludes the end, like Python lists. I use loc for filters such as df.loc[df["status"] == "paid", "amount"] and iloc when I need the first or last rows regardless of the index.

2
How do you handle missing values in a dataset?

First I measure them with df.isna().sum() and look at whether they are random or tied to a source, such as one branch that never fills a field. Then I decide per column: drop rows if few are affected, fill with a sensible value such as 0 for no sales or the median for a numeric field, or keep them and flag them. I write down the choice so the result can be reproduced.

3
A merge gave you more rows than the left table had. What happened?

The key is almost certainly duplicated in the right table, so each left row matched more than once. I check with right["key"].duplicated().sum(), then either remove duplicates or aggregate the right table first. On important joins I pass validate="many_to_one" so pandas raises an error instead of silently inflating totals.

Advertisement
4
When would you use apply, and when would you avoid it?

I avoid apply when a vectorised operation exists, such as column arithmetic, str methods or np.where, because those run much faster on large data. I use apply for logic that does not fit a built-in method, for example parsing an irregular text field with a custom function. If performance matters, I test both on a sample.

5
What is the difference between groupby and pivot_table?

Both aggregate by groups. groupby returns a long result indexed by the group keys, which is good for further processing. pivot_table spreads one key across columns to make a grid, which suits reports, for example regions as rows and months as columns with summed sales.

6
How would you check that your analysis output is correct?

I compare row counts before and after each join or filter, and check that totals still add up to the source total. I also recalculate one or two groups by hand or in a spreadsheet. For example, if the report says region North sold 4,200 units, I filter the raw data for North and sum it to confirm.

Practise out loud. Say each answer once as written, then again in your own words with your own number or story.

Have a number ready. "My Data analysis (Pandas) score is at benchmark on a timed test" is a stronger answer than "I am good at it". Take the test and quote the result.

Advertisement
Continue with Data analysis (Pandas)4 lessons · 1 interview set · 1 test · 1 certificate
Not tested

More in Data and AI