InterviewStack.io LogoInterviewStack.io

Python Programming & ML Libraries Questions

Python programming language fundamentals (syntax, data structures, control flow, error handling) with practical usage of machine learning libraries such as NumPy, pandas, scikit-learn, TensorFlow, and PyTorch for data manipulation, model development, training, evaluation, and lightweight ML tasks.

EasyTechnical
21 practiced
Given a pandas DataFrame `df` with columns ['user_id','event','value'], write code to compute for each user the average `value` per event type and return a pivoted DataFrame where rows are user_id and columns are event types. Include handling for missing event types and show example input and output behavior.
MediumTechnical
23 practiced
A NumPy-based function you wrote runs slower than expected because of unnecessary copies and temporary arrays. Describe common causes for NumPy performance issues (copying, non-contiguous arrays, Python loops) and give specific code-level fixes for each cause.
HardSystem Design
24 practiced
Design an end-to-end training pipeline for a supervised learning model that will be retrained weekly: include data ingestion, validation, feature store, experiment tracking, resource scheduling, and deployment steps. Specify scale assumptions (100M rows/day, models updated weekly) and describe trade-offs for retraining frequency and storage.
MediumTechnical
25 practiced
You have a pandas groupby transform that runs slowly on a DataFrame with 10M rows. Describe 5 practical optimizations to speed up groupby aggregations or replace them with faster approaches, considering dtypes, indexing, chunking, categorical encoding, and third-party tools.
HardTechnical
22 practiced
You must train scikit-learn models on a dataset that is larger than memory. Propose and implement an approach using Dask or `partial_fit` with chunks, explain when each is appropriate, and discuss how to evaluate and checkpoint models during a long-running out-of-core training job.

Unlock Full Question Bank

Get access to hundreds of Python Programming & ML Libraries interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.