InterviewStack.io LogoInterviewStack.io

Python for Data Analysis Questions

Covers the practical use of Python and its data libraries to perform data ingestion, cleaning, transformation, analysis, and aggregation. Candidates should be able to manipulate data frames, perform complex grouping and aggregation operations, merge and join multiple data sources, and implement efficient vectorized operations using libraries such as Pandas and NumPy. Expect to write clear, idiomatic Python with appropriate error handling, input validation, and small tests or assertions. At more senior levels, discuss performance trade offs and scalability strategies such as choosing NumPy vectorization versus Pandas, and when to adopt alternative tools like Polars or Dask for very large datasets, as well as techniques for memory management, profiling, and incremental or streaming processing. Also cover reproducibility, serialization formats, and integrating analysis into pipelines.

MediumSystem Design
55 practiced
Design a pandas-based pipeline to read all CSV files in a directory, concatenate them into a single DataFrame, coerce consistent dtypes using an explicit dtype mapping, and write partitioned Parquet files by calendar year. Describe potential pitfalls and memory-saving techniques in your design.
EasyTechnical
49 practiced
Explain the difference between a pandas Series and a pandas DataFrame. Provide short Python examples to create each and describe two practical scenarios in data analysis when you'd prefer a Series versus a DataFrame.
HardTechnical
61 practiced
Provide a code sketch in Python for a memory-efficient out-of-core groupby aggregation over a 100M-row CSV: process in chunks, write partial aggregates partitioned by a hash of the group key to disk, then merge partitions to produce final aggregates. Explain intermediate disk layout, complexity, and failure recovery considerations.
MediumTechnical
54 practiced
You have a table of events with columns ['user_id', 'event_time', 'event_type', 'value'] and multiple events per user. Write efficient pandas code that computes the time difference in seconds from each event to the previous event for the same user, ensuring the events are correctly ordered per user and handling missing or duplicate timestamps.
MediumTechnical
57 practiced
Outline the steps and tools you would use to profile a slow pandas job to determine whether the bottleneck is CPU, Python-level loops, memory pressure, or I/O. Mention specific profiling tools/libraries and what you would look for in their output.

Unlock Full Question Bank

Get access to hundreds of Python for Data Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.