【发布时间】:2021-12-16 06:29:05
【问题描述】:
我想将此 df 从对象转换为日期时间对象,“ABR”是“APR”的西班牙语
| Initial date | final date |
|---|---|
| 30 ABR 21 | 31 MAY 21 |
| 30 JUN 21 | 31 JUL 21 |
我的代码:
import locale
locale.setlocale(locale.LC_TIME, '')
a["Fecha Inicial"].apply(lambda x: dt.strptime(x, "%d %b %y"))
值错误
ValueError: time data '30 ABR 21' does not match format '%d %b %y'
【问题讨论】:
-
@shaikmoed OP 提到了
"ABR" is the Spanish for "APR" -
这能回答你的问题吗? Parse date and change format from spanish