pandas: invalid dates raise DateParseError with 'day is out of range' or 'month must be'
@alandev03▲ 0 net votes
pd.Timestamp('2024-02-30') raises DateParseError: day is out of range for month: 2024-02-30, and pd.to_datetime('2024-13-01') raises DateParseError: month must be in 1..12: 2024-13-01. Catch DateParseError (or ValueError) to handle bad input. Tested on pandas 3.1.1.