InterviewStack.io LogoInterviewStack.io

Pandas Data Manipulation and Analysis Questions

Data manipulation and analysis using the Pandas library: reading data from CSV or SQL sources, selecting and filtering rows and columns, boolean indexing, iloc and loc usage, groupby aggregations, merging and concatenating DataFrames, handling missing values with dropna and fillna, applying transformations via apply and vectorized operations, reshaping with pivot and melt, and performance considerations for large DataFrames. Includes converting SQL style logic into Pandas workflows for exploratory data analysis and feature engineering.

HardTechnical
57 practiced
Design an incremental feature generator (pseudo-code acceptable) in pandas that consumes streaming events and maintains per-user online features: count, approximate unique_count, last_seen, and time_since_last_event. Explain how to persist and checkpoint state between runs, how to handle exactly-once vs at-least-once ingestion semantics, and ways to recover from crashes without double-counting.
MediumTechnical
74 practiced
Demonstrate how to use pandas.eval and DataFrame.query to compute a new column 'score' as 0.3 * a + 0.7 * b and then filter rows where score > 0.5. Provide code examples and explain when pandas.eval (with numexpr) gives performance benefits and what safety considerations exist.
EasyTechnical
66 practiced
Explain differences and use-cases for df.loc, df.at, df.iloc and df.iat. Provide concrete code to get and set a single scalar efficiently and describe why SettingWithCopyWarning occurs and how to avoid it in assignment pipelines.
MediumTechnical
69 practiced
Given a transactions DataFrame with columns ['user_id','country','amount','timestamp'], write pandas code to compute per (user_id,country): total_amount, avg_amount, transaction_count and the 95th percentile of amount. Use named aggregations and show how to return a flat DataFrame rather than a hierarchical index.
HardTechnical
54 practiced
A pivot_table produced hierarchical columns like ('sales','sum') and ('sales','mean'). Write robust pandas code to flatten MultiIndex columns into single strings like 'sales_sum' and ensure deterministic ordering. Also describe how to handle potential duplicate names after flattening and how to avoid clashing column names.

Unlock Full Question Bank

Get access to hundreds of Pandas Data Manipulation and Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.