pandas transform date format 3f

Solutions on MaxInterview for pandas transform date format 3f by the best coders in the world

showing results for - "pandas transform date format 3f"
Léo
07 Jul 2016
1import pandas as pd
2
3df = pd.DataFrame({'DOB': {0: '26/1/2016', 1: '26/1/2016'}})
4print (df)
5         DOB
60  26/1/2016 
71  26/1/2016
8
9df['DOB'] = pd.to_datetime(df.DOB)
10print (df)
11         DOB
120 2016-01-26
131 2016-01-26
14
15df['DOB1'] = df['DOB'].dt.strftime('%m/%d/%Y')
16print (df)
17         DOB        DOB1
180 2016-01-26  01/26/2016
191 2016-01-26  01/26/2016
20