← Pinterest Interview Insights

Pinterest·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Pinterest data science interview with a pandas-heavy coding question. The problem looked straightforward but had a bunch of data quality landmines buried in it that you had to catch on your own.

Questions Asked (1)

Q1

Given a DataFrame with user engagement data on pins, filter to video pins (handling case variations and typos like 'vedio'), normalize and map categories using a provided dictionary, exclude invalid time values, and return the canonical category with the highest average time spent along with that average rounded to two decimals.

Product Analytics & MetricsAlgorithms & Data Structures
Author's notes

The typo thing ('vedio') is the kind of thing you either catch or you don't.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining a clear data cleaning pipeline: filter video pins with case-insensitive and fuzzy matching, map categories using the provided dictionary, and exclude invalid time values. Then compute average time spent per canonical category and return the top category with its rounded average. Emphasize robustness and reproducibility in your code.

Pro tip: Mention that you would validate the category mapping by checking for unmapped values and log them for review, ensuring data quality before aggregation. Also, consider using vectorized operations for efficiency with large datasets.

1. Filter video pins

Use case-insensitive string matching and handle common typos like 'vedio' by normalizing the pin type column (e.g., lowercasing and applying fuzzy matching or a predefined correction map).

2. Normalize and map categories

Apply the provided dictionary to map raw category values to canonical categories, ensuring all values are covered and handling any unmapped entries appropriately.

3. Exclude invalid time values

Remove rows where time spent is missing, negative, or non-numeric, and consider setting a reasonable upper bound to exclude outliers if necessary.

4. Compute average time per category

Group the cleaned data by canonical category and calculate the mean time spent for each category.

5. Return top category and rounded average

Identify the category with the highest average time spent and return it along with the average rounded to two decimal places.

Key Points to Mention

  • Case-insensitive filtering and typo handling (e.g., 'vedio' -> 'video')
  • Using the provided mapping dictionary for category normalization
  • Data validation: excluding invalid time values (negative, missing, non-numeric)
  • Grouping and aggregation with pandas (groupby, mean)
  • Rounding the final average to two decimals
  • Handling potential unmapped categories or missing values

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.