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
58 practiced
You need to enrich a 50M-row transactions DataFrame with a small categories lookup of 1000 rows. Provide strategies to perform this enrichment efficiently in pandas while minimizing memory and time, such as mapping via a dict, setting the lookup as index and joining, converting join key to categorical, or using chunked processing. Provide code examples and explain runtime and memory trade-offs.
MediumTechnical
62 practiced
You need to create a new column 'customer_avg' containing each order's customer's average order amount. Show two implementations: one using groupby + transform and one using groupby + apply (or agg + merge). Explain differences in alignment, speed, and memory usage between the two approaches.
MediumTechnical
70 practiced
You are asked to filter a transaction DataFrame df_transactions to find high-value active transactions: amount > 1000, status in ['confirmed','shipped'], and country not in ['US','CA']. Write pandas code using boolean masks and using df.query to accomplish the same filter. Also explain how to handle column names that include spaces or special characters in df.query.
MediumTechnical
74 practiced
As a BI analyst you have three DataFrames: customers (customer_id, name), orders (order_id, customer_id, amount), and refunds (refund_id, order_id, refunded_amount). Explain when to use pd.concat versus pd.merge and provide pandas code to: (a) vertically concatenate monthly sales DataFrames, (b) left-join orders to customers to attach names, and (c) join refunds to orders and compute net_revenue per order.
HardSystem Design
63 practiced
Design an automated ETL pipeline using Python/pandas that runs daily to refresh dashboards. Include components for extraction (SQL/CSV), transformation (pandas scripts), loading (data warehouse or parquet store), scheduling/orchestration (Airflow or Prefect), incremental loads, idempotency, monitoring, and alerting. Provide high-level pseudo-code for orchestration and explain how you'd handle failures and retries.
Unlock Full Question Bank
Get access to hundreds of Pandas Data Manipulation and Analysis interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.