To convert a datetime format from '2023-01-01 00:00:00' to '11-may-2023' using pd.to_datetime
in Python, you can follow these steps:
main.py324 chars11 lines
This will output:
main.py12 chars2 lines
In the strftime
function, %d
represents the day with leading zeros, %b
represents the abbreviated month name, and %Y
represents the four-digit year.
gistlibby LogSnag