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.
MediumTechnical
0 practiced
Given time-series data per user, implement rolling-window feature generation that computes mean, std, min, and max over the past 7 days per user using pandas. Show an efficient approach using groupby + rolling that avoids expanding intermediary dataframes unnecessarily and explain index requirements for groupby. Provide code and discuss performance implications.
MediumTechnical
0 practiced
You find a Python loop performing element-wise computations on large NumPy arrays that is a performance hotspot. Describe how you would profile the code to find the bottleneck and convert the loop into vectorized NumPy operations. Provide a before-and-after snippet for a concrete example and discuss memory trade-offs (copying vs views).
EasyTechnical
0 practiced
Describe a recommended procedure to set random seeds for reproducibility across Python's random, NumPy, PyTorch, and TensorFlow. Include device-specific concerns (GPU), cuDNN deterministic flags, and discuss trade-offs between reproducibility and performance or parallelism.
HardTechnical
0 practiced
Design a scikit-learn-compatible transformer that implements target (mean) encoding but prevents leakage during cross-validation and grid search. Provide a design or code sketch that supports out-of-fold encoding during fit and produces correct encodings during transform on new data. Explain how this integrates with Pipeline and GridSearchCV.
EasyTechnical
0 practiced
Write a Python function compute_mean_std(nums: List[float]) -> Tuple[float, float] that computes the mean and sample standard deviation in a single pass without using NumPy. Your implementation should be numerically stable for long streams of values (hint: use Welford's algorithm). Provide the function code and briefly explain time and space complexity and why this approach is numerically stable.
Unlock Full Question Bank
Get access to hundreds of Python Programming & ML Libraries interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.