change multiple columns in pandas dataframe to datetime

后端 未结 5 2023
无人及你
无人及你 2021-01-30 22:38

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 thi

5条回答
  •  醉酒成梦
    2021-01-30 23:07

    If you rather want to convert at load time, you could do something like this

    date_columns = ['c1','c2', 'c3', 'c4', 'c5']
    data = pd.read_csv('file_to_read.csv', parse_dates=date_columns)
    

提交回复
热议问题