Python
All Top 50 Python & Pandas Interview Questions#25
Parse Ambiguous Date Formats with pd.to_datetime in Pandas
MediumInterview Question #25
Given a noisy date column with mixed formats and corrupt text like `'2026-01-15'`, `'15/02/2026'`, and `'UNKNOWN'`, parse them into datetime and isolate corrupt records.
Input Table: dates
2 rows preview| raw_date |
|---|
| 2026-01-15 |
| UNKNOWN_DATE |
Expected Output Structure2 rows
| parsed_date |
|---|
| 2026-01-15 00:00:00 |
| NULL |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Click "Run & Test" to execute your Pandas code against the test assertions.