How can I convert a DataFrame column of strings (in dd/mm/yyyy format) to datetimes?
Python – Convert DataFrame column type from string to datetime, dd/mm/yyyy format
dataframedatetime-formatpandaspythonpython-datetime
Related Topic
- Python – Renaming column names in Pandas
- Python – Adding new column to existing DataFrame in Python pandas
- Python – Delete a column from a Pandas DataFrame
- Python – How to drop rows of Pandas DataFrame whose value in a certain column is NaN
- Python – Change column type in pandas
- Python – How to iterate over rows in a DataFrame in Pandas
- Python – How to select rows from a DataFrame based on column values
- Python – Get a list from Pandas DataFrame column headers
Best Answer
The easiest way is to use
to_datetime
:It also offers a
dayfirst
argument for European times (but beware this isn't strict).Here it is in action:
You can pass a specific format: