0

I have a pandas dataframe with dates in the following format:

Dec 11, 2018

Wondering is there an easy way to change the format to 11/12/2018? I know I can go through each month manually but not sure what my next step would be to switch around the month and day and add the /.

Thanks in advance!

dylan193
  • 13
  • 3

1 Answers1

1

Use strftime('%m/%d/%Y'):

s = pd.Series(['Dec 11, 2018'])

pd.to_datetime(s).dt.strftime('%m/%d/%Y')

Output:

0    12/11/2018
dtype: object
mozway
  • 81,317
  • 8
  • 19
  • 49