I want to convert a column in my python dataframe. The column is of type object.
From Dec-21-20 09:20PM
to This 2020-12-21 21:20:00:00.000
I want to convert a column in my python dataframe. The column is of type object.
From Dec-21-20 09:20PM
to This 2020-12-21 21:20:00:00.000
df["column"] = pd.to_datetime(df["column"])
If you need more specific formatting, edit your question and comment back so I can adjust my answer accordingly.
If you are looking to convert it into dtype: datetime64[ns]
then use: df["column"] = pd.to_datetime(df["column"])
or specify your format
pd.to_datetime(pd.Series(['05/23/2005']), format="%m/%d/%Y")
Out[12]:
0 2005-05-23
dtype: datetime64[ns]
once you have that you can use pandas.Series.dt.strftime
to any format of string you want