I have a date column in a df with values like Fri Apr 01 16:41:32 +0000 2022. I want to convert it into proper date column format 01/04/2022 16:41:32. Where 01 is day and 04 is the month.
Any guidance please?
>Solution :
You can use pandas.to_datetime for getting datetime then with Series.dt.strftime convert to desired format.
import pandas as pd
# example df
df = pd.DataFrame({'date': ['Fri Apr 01 16:41:32 +0000 2022' ,
'Sat Apr 02 16:41:32 +0000 2022']})
df['date'] = pd.to_datetime(df['date']).dt.strftime('%d/%m/%Y %H:%M:%S')
print(df)
date
0 01/04/2022 16:41:32
1 02/04/2022 16:41:32