InterviewStack.io LogoInterviewStack.io

Python Data Manipulation with Pandas Questions

Skills and concepts for extracting, transforming, and preparing tabular and array data in Python using libraries such as pandas and NumPy. Candidates should be comfortable reading data from common formats, working with pandas DataFrame and Series objects, selecting and filtering rows and columns, boolean indexing and query methods, groupby aggregations, sorting, merging and joining dataframes, reshaping data with pivot and melt, handling missing values, and converting and validating data types. Understand NumPy arrays and vectorized operations for efficient numeric computation, when to prefer vectorized approaches over Python loops, and how to write readable, reusable data processing functions. At higher levels, expect questions on memory efficiency, profiling and optimizing slow pandas operations, processing data that does not fit in memory, and designing robust pipelines that handle edge cases and mixed data types.

MediumTechnical
78 practiced
Explain how to clean a free-text column of phone numbers using pandas string methods to produce a standardized E.164-like format (e.g., +1XXXXXXXXXX). Provide an approach that removes non-digits, handles leading zeros, and deals with missing country codes conservatively.
MediumTechnical
72 practiced
Write pandas code using groupby and agg to compute per-product: total_revenue, average_price, unique_customers, and first_order_date. Use named aggregation and show how to reset the index to a flat DataFrame. Include handling for products with no sales in the period (they should appear with zeros/NaN appropriately).
MediumTechnical
71 practiced
Describe an approach to deduplicate and canonicalize customer records when you have multiple identifiers and partial matches (e.g., same email, slightly different names). Which pandas techniques and external libraries might you use, and how would you validate deduplication accuracy?
MediumTechnical
64 practiced
You need to create a reusable pandas data processing function that processes multiple input file formats (CSV, JSON, parquet). Design a small API for a function process_file(path, file_type=None, **options) that returns a cleaned DataFrame. Show example implementation outline and explain how you'd unit test and document supported options.
EasyTechnical
80 practiced
Using Python and pandas, write code to read a CSV file named 'sales.csv' with columns: order_id (int), order_date (YYYY-MM-DD), customer_id (int), amount (float). Show how you would: a) parse order_date as datetime, b) enforce dtypes for ids, c) handle malformed lines and custom NA tokens, and d) load the file safely if it contains mixed encodings. Explain the key read_csv parameters you chose.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.