Parse the correct datetime for multiple columns and different formats in the same column
Hello community,
I have a csv file that I uploaded to jupyter notebook using read_csv from pandas.
I am trying to parse correctly date-times for multiple columns.
In the same column, I have two formats of DateTime:
1- 2022-01-05T02:24
2- 2022-01-05T02:10:58
I have tried this method:
dateparse = lambda x: datetime.strptime(x, '%Y-%m-%dT%H:%M:%S')
df= pd.read_csv("data.csv", sep=",", encoding = "ISO-8859-1", low_memory=False, date_parser=dateparse)
But it doesn't parse right even this format "2022-01-05T02:10:58" I want to ask you if there is an alternative to use to parse correctly my columns of type DateTime.
I am using the low_memory= False because when I don't use it, I have this warning:
DtypeWarning: Columns (28,29,56,71) have mixed types. Specify dtype option on import or set low_memory=False
Thank you,