Removing the timestamp from a datetime in pandas dataframe

Solution 1:

You can do the following:

dfST['timestamp'] = pd.to_datetime(dfST['timestamp'])

to_datetime() will infer the formatting of the date column. You can also pass errors='coerce' if the column contains non-date values.

After completing the above, you'll be able to create a new column containing only date values:

dfST['new_date_column'] = dfST['timestamp'].dt.date