【发布时间】:2021-06-13 00:37:26
【问题描述】:
我是 python 新手。我有一个数据框,其中有一个日期列,它有不同的格式。我想检查它是否遵循特定的日期格式。我没有跟随我想放弃它。我尝试使用 try except 并遍历行。但我正在寻找一种更快的方法来检查列是否遵循特定的日期格式。 If it is not following then it has to drop. Is there any faster way to do it? Using DATE TIME library?
My code:
Date_format = %Y%m%d
df =
Date abc
0 2020-03-22 q
1 03-12-2020 w
2 55552020 e
3 25122020 r
4 12/25/2020 r
5 1212202033 y
Excepted out:
Date abc
0 2020-03-22 q
【问题讨论】:
标签: python dataframe date datetime date-formatting