python
data_error
ai_generated
true
ValueError:时间数据 '2024-13-45' 与格式 '%Y-%m-%d' 不匹配
ValueError: time data '2024-13-45' does not match format '%Y-%m-%d'
ID: python/pandas-parse-dates-error
80%修复率
87%置信度
0证据数
2024-06-03首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
日期字符串无效(月/日超出范围)或格式字符串不正确。
English
Date string is invalid (month/day out of range) or format string incorrect.
解决方案
-
95% 成功率
pd.to_datetime(s, errors='coerce') then inspect s.isna()
-
85% 成功率
pd.to_datetime(s, format='mixed', dayfirst=False)
无效尝试
常见但无效的做法:
-
75% 失败
Silently drops data; root data quality issue persists
-
85% 失败
Produces wrong dates for valid rows