I have the following DataFrame df
:
df =
date time val1
1/17/2018 18:00 20.0
1/17/2018 18:02 21.1
1/17/2018 18:10 23.2
1/17/2018 18:12 22.0
17/1/2018 18:12 22.1
17-Jan-2018 18:12 22.0
1/18/2018 60 22.1
aa 17:30 23.3
17/1/20188 18:00 19.0
The condition to delete rows:
- if the format of a field
date
does not correspond to '%d/%m/%Y'. - if the format of a field
time
does not correspond to "%H:%M".
Based on these two conditions the last 5 rows in df
should be deleted to get a new clean dataframe.
How can I do it? Thanks.