How to parse date column in pandas

If you have a pandas column containing a date string

example.py
df

 

which is listed as object:

example.py
df["date"]

parse it like this:

example.py
df["date"] = pd.to_datetime(df["date"])

After which it will be listed as datetime64[ns]:

example.py
df["date"]


Check out similar posts by category: Pandas, Python