Date time conversion in pandas

Am trying to convert 2021-03-31 20:44:01 to 03/31/2021 20:44:01 in pandas. I tried dt.strftime("%m/%d/%y") and it converts to mm/dd/yyyy but am not sure how to retain the timestamp part. I tried dt.strftime("%m/%d/%Y %H%M%S") but it is not working. Thanks.



Read more here: https://stackoverflow.com/questions/67009371/date-time-conversion-in-pandas

Content Attribution

This content was originally published by Vinoth at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: