I have a dataframe of 13 columns and 55,000 rows I am trying to convert 5 of those rows to datetime, right now they are returning the type 'object' and I need to transform this data for machine learning I know that if I do
data['birth_date'] = pd.to_datetime(data[birth_date], errors ='coerce')
it will return a datetime column but I want to do it for 4 other columns as well, is there one line that I can write to call all of them? I dont think I can index like
data[:,7:12]
thanks!
read_csvhas aparse_datesargument that can take a list of all the columns you would like to convert when first importing your data.