Multi-part question, generally testing data aggregation and window functions in the language of your choice.
Start by clarifying the dataset and the specific analysis goal, then walk through your pandas workflow step by step: loading, cleaning, exploring, and deriving insights. Emphasize reproducibility and explain your reasoning at each stage, using toy datasets like tips or iris to illustrate key operations.
Pro tip: Demonstrate awareness of data quality and edge cases (e.g., missing values, data types) even with toy datasets, and mention how you would validate results—this shows maturity beyond just writing code.
Ask clarifying questions about the dataset (e.g., size, columns, known issues) and the analysis goal (e.g., summary statistics, trend identification). Confirm assumptions before diving into code.
Use pandas to read the data (e.g., pd.read_csv) and perform initial checks: .head(), .info(), .describe(), and .isnull().sum() to understand structure and quality.
Handle missing values, convert data types, rename columns, and filter outliers as needed. Explain each transformation and its rationale.
Use groupby, pivot_table, or aggregation functions to answer the core question. Walk through the code logic and interpret intermediate results.
Present key insights clearly, check for consistency (e.g., cross-tabulations), and mention how you would validate or extend the analysis with more data.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.