← OneMain Financial Interview Insights

OneMain Financial·Data Scientist·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Technical screen for a Data Scientist role at OneMain Financial. The whole thing was basically one long pandas/session-analytics problem that kept growing more constraints as I thought I was finishing it. Harder than I expected for what I assumed would be a standard DS interview.

Questions Asked (1)

Q1

Given a pandas DataFrame with user events (including a string/ISO8601 timestamp column that can be missing, a server-side datetime column, a URL, and a user ID), build 30-minute inactivity-based sessions per user. You need to: impute missing timestamps from the server log column, sort events robustly even if rows are out of order, assign session IDs when the gap between consecutive events exceeds 30 minutes, compute per-user stats (session count, median session duration, 95th percentile of pages per session), and make sure the whole thing works in streaming chunks without loading all users into memory at once. Also explain correctness on edge cases like exactly-30-minute gaps, duplicate events, and DST shifts.

System DesignData ModelingTechnical Trade-offs
Author's notes

This one just kept expanding.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data schema and business rules (e.g., timestamp priority, session definition, edge cases). Then outline a chunked processing pipeline that handles imputation, sorting, sessionization, and aggregation per user, ensuring memory efficiency. Finally, discuss correctness on edge cases and trade-offs.

Pro tip: Emphasize the importance of defining a clear tie-breaking rule for duplicate events and handling DST by converting all timestamps to UTC before sessionization. This shows attention to real-world data pitfalls.

1. Clarify requirements and data assumptions

Confirm the priority for timestamp imputation (e.g., use server timestamp if client timestamp is missing), the definition of a session (inactivity gap > 30 minutes), and how to handle edge cases like exactly 30-minute gaps, duplicates, and DST.

2. Design a chunked processing pipeline

Process data in chunks (e.g., by user ID or time windows) to avoid loading all users into memory. For each chunk, impute missing timestamps, sort events by timestamp (and a tie-breaker), and assign session IDs based on the 30-minute gap rule.

3. Implement sessionization and aggregation

Within each user's sorted events, compute the time difference between consecutive events. Start a new session when the gap exceeds 30 minutes. Then compute per-user stats: session count, median session duration, and 95th percentile of pages per session.

4. Address edge cases and correctness

Explain how to handle exactly 30-minute gaps (typically not a new session if the rule is 'exceeds 30 minutes'), duplicate events (deduplicate or keep based on business rules), and DST shifts (convert to UTC to avoid ambiguity).

5. Discuss trade-offs and scalability

Mention trade-offs between memory and computation (e.g., sorting per user vs. global sort), and how the chunked approach scales. Highlight any assumptions that could affect results.

Key Points to Mention

  • Timestamp imputation: use server-side datetime when client timestamp is missing, and document the priority.
  • Sorting: sort by timestamp and a secondary key (e.g., event ID) to ensure deterministic order for duplicates.
  • Session boundary: new session when gap > 30 minutes; exactly 30 minutes does not start a new session.
  • DST handling: convert all timestamps to UTC before computing gaps to avoid issues with daylight saving time.
  • Chunked processing: process per user or in time-based chunks to keep memory usage low, using groupby or iterative methods.
  • Edge cases: duplicate events (deduplicate or keep based on business logic), missing timestamps (impute), and out-of-order events (sort).

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