Analyze Hourly Distance and Airport Trips
Company: Capital One
Role: Software Engineer
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Online Assessment
# Analyze Hourly Distance and Airport Trips
Use green-taxi trip records to answer two analytical questions. The source does not define one output table, an airport boundary, a fare field, or ordering rules. State those choices explicitly and treat the result as a documented analysis rather than a fixed SQL-console relation.
### Clarifying Questions to Ask
- Which timestamp determines hour of day, and in which timezone?
- What spatial rule identifies an airport origin or destination?
- Which fare measure is intended, and how should invalid or incomplete trips be handled?
### Part 1 — Distance by Hour
Report mean and median trip distance grouped by hour of day, with data-quality and sample-size context.
#### What This Part Should Cover
- A defined timestamp, 24-hour grouping, null policy, and trip eligibility rule.
- Counts alongside mean and median so sparse or skewed groups are visible.
### Part 2 — Airport-Related Trips
Define a reproducible airport-trip criterion, then report the exact count, average chosen fare measure, and other characteristics that help explain how these trips differ.
#### What This Part Should Cover
- A defensible spatial classification and treatment of boundary uncertainty.
- Counts, fare summary, useful comparisons, and stated limitations.
```hint Audit the classification before aggregating
Inspect trips just inside and outside each airport boundary and quantify missing coordinates.
```
### What a Strong Answer Covers
- Explicit definitions instead of hidden assumptions.
- Robust treatment of skew, invalid records, and incomplete observation.
- Reproducible calculations with interpretation separated from fact.
### Follow-up Questions
- How would median distance change the story relative to mean distance?
- How would you validate airport classification without a trusted zone label?
Overview: Compute mean and median trip distance by hour, identify trips that start or end near area airports, and report their count, average fare, and additional grouped characteristics.