Home

Published

- 1 min read

pandas datetime show only date

img of pandas datetime show only date

The solution for this is noted below

pandas datetime show only date

Solution

   # Changing object type column to datetime
df['date_col'] = pd.to_datetime(df.date_col)

# Creating new column with just the date
df['new_date_col'] = df['date_col'].dt.date

Try other methods by searching on the site. That is if this doesn’t work