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.

MediumTechnical
45 practiced
When pandas groupby.apply is too slow for a custom aggregation, how can you accelerate the logic using Numba? Provide an example where you compute per-group top-k largest values by writing a Numba-jitted function that accepts NumPy arrays and integrates with pandas by extracting arrays per group. Discuss limitations of Numba interacting with pandas objects.
HardTechnical
84 practiced
Compare Parquet, Apache Arrow IPC/Feather, HDF5, and CSV for storing feature datasets used in ML workflows. For each format discuss columnar vs row-wise access patterns, schema evolution, compression, random access, cross-language compatibility, streaming reads/writes, and recommended usage for training pipelines vs online serving.
HardSystem Design
44 practiced
Design a reproducible data preparation system for model training in Python. Include deterministic seeding, reproducible data splits, dataset versioning and storage, schema validation, environment pinning (libraries), and serialization of preprocessing metadata. Show how you'd integrate this into CI/CD and provide examples of tools (DVC, Quilt, DeltaLake, Docker) and concrete steps to guarantee reproducibility.
MediumTechnical
50 practiced
You must join two large DataFrames that do not comfortably fit in memory on column 'user_id'. Discuss practical strategies in Python to perform this join efficiently: using index-based joins (set_index + join), categorical codes to reduce memory, chunked joins, using Dask/Spark, or falling back to a disk-based DB. Evaluate tradeoffs and outline code sketches.
HardTechnical
44 practiced
Implement a performant Bayesian-smoothed conversion-rate calculation for products: given arrays of clicks and impressions, compute posterior mean rates using a Beta(alpha,beta) prior. Provide a Numba-jitted function that accepts NumPy arrays of successes and trials and returns smoothed rates. Discuss numerical stability and when vectorized NumPy is sufficient instead.

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.