Python and Pandas for Data Analysis Questions

Programmatic data manipulation and analysis in Python and R. Covers pandas transformations, joins and reshaping, aggregation, working with PySpark for larger data, and using R for statistical analysis. Emphasizes clean, reproducible analytical code.

MediumTechnical
54 practiced

Given time-series data per user, you need the mean, standard deviation, min, and max over the trailing 7 days, computed separately for each user. Show an efficient pandas approach that avoids materializing unnecessary intermediate DataFrames, and explain what indexing requirements your approach depends on.

HardTechnical
63 practiced

A left merge between orders and customers unexpectedly resulted in fewer rows than the original orders DataFrame. Walk through how you would diagnose why rows were lost, and what you would check first.

MediumTechnical
56 practiced

Explain when a pandas MultiIndex is appropriate. Show code to create a MultiIndex on ['user_id','date'] and perform an efficient lookup for a specific (user_id, date) tuple. Discuss pros/cons of MultiIndex vs a single composite key column for performance and API ergonomics.

HardTechnical
67 practiced

You must join customer records from two sources where the same person's name and address are spelled slightly differently between systems (typos, abbreviations, formatting differences), so an exact-key join misses real matches. Propose an approach to link these records that scales beyond a handful of rows, and discuss how you would guard against false matches and validate the results before trusting them downstream.

MediumTechnical
63 practiced

You have two DataFrames: prices (timestamp, symbol, price) and trades (timestamp, symbol, quantity). For each trade, you need the most recent price for that symbol at or before the trade's own timestamp. Write pandas code to produce this, explain what ordering your approach depends on, and how you would restrict matches to the same symbol.

Unlock Full Question Bank

Get access to all Python and Pandas for Data Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.