I'm trying to reformat the following column names. They all have been converted to datetime columns already.
The code works for the first 3 columns in my list. However, the last two columns breaks it.
date_columns = ['DTI', 'DTO', 'DTD', 'DTE', 'DTINS']
for i in date_columns:
df_EVENT5_13[i] = df_EVENT5_13[i].apply(lambda x:x.date().strftime('%m/%d/%Y'))
Below is the error I get:
ValueError: NaTType does not support strftime
try df_EVENT5_13[i] = df_EVENT5_13[i].dt.date