PIQ : 101-150


๐Ÿ”น Pandas Interview Questions (Set 7)

๐Ÿ› ๏ธ Data Engineering and Wrangling

  1. How do you create a DataFrame from nested dictionaries or JSON structures?

  2. How would you split a column with delimited strings (e.g., "a,b,c") into separate columns?

  3. How do you conditionally update values in one column based on another columnโ€™s values?

  4. What does cut() vs qcut() do in Pandas? How are they different?

  5. How do you sample a fraction of a DataFrame while maintaining stratification (proportions)?

โš™๏ธ Pandas Internals and Indexing

  1. What is the difference between a shallow copy and a deep copy in Pandas?

  2. How does Pandas handle operations with mismatched indexes between Series or DataFrames?

  3. How can you reindex a DataFrame to align with a new index, and how do you handle missing rows?

  4. How do you convert a MultiIndex into a flat DataFrame with normal columns?

  5. How does Pandas handle arithmetic operations when null values are involved?

๐Ÿ“ Data Summary & Quality Assurance

  1. How would you summarize the distribution of numeric data in a DataFrame?

  2. How can you identify duplicate columns in a DataFrame?

  3. Whatโ€™s the best way to identify columns with constant or low variance?

  4. How can you check if a column is monotonically increasing or decreasing?

  5. How would you validate if a DataFrame is sorted by a column (or multiple columns)?

๐Ÿš€ Performance Optimization

  1. How can you speed up large file ingestion in Pandas? Mention specific parameters.

  2. What techniques can you use to reduce memory usage in large DataFrames?

  3. How would you vectorize a function that was previously applied via apply() or loops?

  4. When should you consider using dask.dataframe or polars instead of Pandas?

  5. How do you chunk a large file and process it iteratively in Pandas without loading the full dataset into memory?


๐Ÿ”น Pandas Interview Questions (Set 8)

๐Ÿ“Š Exploratory Data Analysis (EDA)

21 . How do you get the number of unique values across all columns in a DataFrame?

  1. How can you display summary statistics grouped by a categorical feature?

  2. How do you find the most frequent value in each column of a DataFrame?

  3. How do you count the number of missing values per column and per row?

  4. How would you use corr() to explore relationships between numerical variables?


๐Ÿ”„ Transformation & Feature Engineering

  1. How do you perform one-hot encoding using Pandas without using sklearn?

  2. How can you generate lag features for a time series DataFrame using Pandas?

  3. How do you apply a different function to each column using apply() or agg()?

  4. How do you handle mixed data types in a single column (e.g., strings and numbers)?

  5. How do you normalize values in each row to sum to 1?


๐Ÿ—ƒ MultiIndex and Hierarchical Data

  1. How do you create a hierarchical index from multiple columns?

  2. How do you swap levels in a MultiIndex DataFrame?

  3. How do you filter rows from a MultiIndex DataFrame using a condition on one level?

  4. How do you unstack and restack MultiIndex levels?

  5. What are the advantages and pitfalls of using MultiIndex structures in Pandas?


๐Ÿ”— Integration & Interoperability

  1. How can you pass a DataFrame directly to a SQL database using Pandas?

  2. How do you load data from an API returning JSON using pd.json_normalize()?

  3. How do you export a DataFrame with datetime columns to Excel and preserve formatting?

  4. How can you compare Pandas and Polars in terms of performance and syntax?

  5. When would you use .values, .to_numpy(), or .to_list() โ€” and what are the trade-offs?


Last updated