Reputation: 133
I have a column that displays date as 2016/26/2 (d/m/y)
How can i display it as 2/26/2016 (m/d/y)?
[in] print(nir['Date'])
[out] 0 2005-01-12
1 2006-01-03
2 2006-01-06
3 2006-01-09
4 2006-01-12
5 2007-01-03
6 2007-01-06
7 2007-01-09
8 2007-01-12
i tried to do this:
nir.Date = ['{}-{}-{}'.format(m,d,y) for y, m, d in map(lambda x: str(x).split('-'), nir.Date)]
but no luck... is there any way to easily swap places of month and day without converting to strings?
Upvotes: 3
Views: 2763