1

How can I convert datetime object

15299   2015-07-27 10:00:00  
Name: date, Length: 15300, dtype: datetime64[ns]

back to (dtype: object) whatever it's called

15299    07/27/2015 10:00:00
Name: date, Length: 15300, dtype: object

Thanks.

saga
  • 736
  • 2
  • 8
  • 20

1 Answers1

1

df['date'].dt.strftime("%m/%d/%Y %H:00:00")

Check this page out for formatting datetime in python.

saga
  • 736
  • 2
  • 8
  • 20
Learner
  • 512
  • 2
  • 7
  • 23
  • It didn't work. It still shows the dtype is datetime64. I am not trying to change hyphen to slash, I want to change datetime to object. – saga Jan 25 '18 at 07:37
  • @yomoko https://stackoverflow.com/questions/6288892/convert-datetime-format – Learner Jan 25 '18 at 10:14