How to change the datetime format in Pandas

You can use dt.strftime if you need to convert datetime to other formats (but note that then dtype of column will be object (string)): import pandas as pd df = pd.DataFrame({‘DOB’: {0: ’26/1/2016′, 1: ’26/1/2016′}}) print (df) DOB 0 26/1/2016 1 26/1/2016 df[‘DOB’] = pd.to_datetime(df.DOB) print (df) DOB 0 2016-01-26 1 2016-01-26 df[‘DOB1’] = df[‘DOB’].dt.strftime(‘%m/%d/%Y’) … Read more