InterviewStack.io LogoInterviewStack.io

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
53 practiced

Show an example of composing a pandas ETL pipeline using method chaining and .pipe for readability and testability. Include steps: read from CSV, filter rows, impute missing values, create features, and write out partitioned parquet. Explain how you would unit-test each independent function used in the pipeline.

EasyTechnical
52 practiced

Write pandas code to filter rows using boolean indexing: from a DataFrame orders with columns ['order_id', 'user_id', 'amount', 'status', 'created_at'], obtain orders where amount > 100, status in ['complete','shipped'], and created_at between '2024-01-01' and '2024-03-31'. Explain how & and | should be used and why parentheses are required. Also show how to chain .query() as an alternative.

MediumTechnical
64 practiced

Given a DataFrame where a column stores JSON strings representing event properties, explain how you would safely turn this column into proper separate columns, including how you would handle rows where the JSON is missing or malformed rather than letting the whole pipeline break.

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
53 practiced

As part of feature engineering, demonstrate how to use pandas' assign, transform, and pipe methods to build a small, readable pipeline that: (1) drops unused columns, (2) creates a new column 'is_active' based on last_login date, (3) encodes a low-cardinality categorical column as codes, and (4) returns the final DataFrame. Explain benefits of using pipe for testability.

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.