panda datetime ymd to dmy

Solutions on MaxInterview for panda datetime ymd to dmy by the best coders in the world

showing results for - "panda datetime ymd to dmy"
Alejandro
17 Apr 2016
1df1['Date'] = pd.to_datetime(df1['Date'], format='%Y%m%d').dt.strftime('%m/%d/%Y')
2df2['Date'] = pd.to_datetime(df2['Date']).dt.strftime('%m/%d/%Y')
3df3['Date'] = pd.to_datetime(df3['Date']).dt.strftime('%m/%d/%Y')
4df4['Date'] = pd.to_datetime(df4['Date']).dt.strftime('%m/%d/%Y')
5
6print df1
7print df2
8print df3
9print df4
10         Date
110  03/01/2016
121  03/01/2016
132  03/01/2016
143  03/01/2016
15         Date
160  01/03/2016
171  01/03/2016
182  01/03/2016
19         Date
200  03/31/2016
211  03/31/2016
222  03/31/2016
23         Date
240  02/25/2016
251  02/25/2016
262  02/25/2016
27
28print type(df1.at[0,'Date'])
29<type 'str'>
30