PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates data-cleaning and aggregation competencies, focusing on handling nonstandard missing-date markers, forward-filling in spreadsheets, correct date-range filtering, pivot-table summarization, and concise pandas grouping and aggregation.

  • Medium
  • Capital One
  • Data Manipulation (SQL/Python)
  • Data Scientist

Fix dash dates and aggregate watch time

Company: Capital One

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Take-home Project

You receive a CSV of ad viewing logs where the date column repeats only on the first row of each block and subsequent rows use a single dash '-' to indicate 'same as above'. Columns: date (YYYY-MM-DD or '-'), time_slot (e.g., '08:00-09:00'), ad_id, watch_seconds (INT). Tiny excerpt: +------------+-----------+-------+---------------+ | date | time_slot | ad_id | watch_seconds | +------------+-----------+-------+---------------+ | 2008-01-01 | 08:00-09:00 | A1 | 120 | | - | 08:00-09:00 | A2 | 90 | | - | 09:00-10:00 | A1 | 150 | | 2008-01-08 | 08:00-09:00 | A1 | 80 | +------------+-----------+-------+---------------+ Task A (Excel): 1) Provide the exact Excel formula to forward-fill the date in cell A2 and down the column, replacing '-' with the most recent actual date above, without using VBA or Power Query. 2) Then, using only worksheet functions, compute the time_slot with the largest total watch_seconds for the week 2008-01-01 to 2008-01-07 inclusive. Give the precise formulas (e.g., SUMIFS-based) and explain how you ensure the date filter is correct and dash rows are included after forward-fill. 3) Provide a pivot-table approach that yields the same answer and state the two field placements and the exact date filter you would set. Task B (pandas alternative): Write concise pandas code (no more than 5 lines) to: read the CSV; forward-fill the date column; filter to 2008-01-01 through 2008-01-07; group by time_slot; compute total watch_seconds; and return the single time_slot with the maximum total. Be explicit about handling '-' values.

Quick Answer: This question evaluates data-cleaning and aggregation competencies, focusing on handling nonstandard missing-date markers, forward-filling in spreadsheets, correct date-range filtering, pivot-table summarization, and concise pandas grouping and aggregation.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Clean and Merge Housing Data - Capital One (easy)
  • Find Lowest Prices for Highly Rated Categories - Capital One (medium)
  • Write SQL to compute campaign net revenue - Capital One (Medium)
  • Merge CSVs and build revenue pivot with pandas - Capital One (Medium)
  • Find top category per region in Aug 2025 - Capital One (Medium)