I am working on an excel file containing below columns:-
df1
Number Dateopened Status Date closed Work
1 2019-10-30 10.10 Open 2019-10-30 12.10 walking
2 2019-9-30 11.10 Open 2019-9-31 12.10 cycling
3 2019-5-30 10.10 Closed 2019-5-30 12.10 nothing
4 2019-4-30 10.10 Open 2019-4-30 12.10 walking
I can change the date format using the below code:-
df1['Dateopened'] = pd.to_datetime(df1['Dateopened']).dt.strftime("%b %d,%Y - %I:%M%p")
df1['Date closed'] = pd.to_datetime(df1['Date closed']).dt.strftime("%b %d,%Y - %I:%M%p")
In my code i need to manually enter the column names.Is there something i can do so that the python code itself search such columns and modify the data format.
