2

If I have a datecolumn of dates likes this

df['date_utc'] = pd.to_datetime(df['date_utc'])
df['date_utc']
0       2020-12-01 22:08:07
1       2020-11-11 14:30:09
2       2020-11-10 18:30:09
3       2020-11-08 15:00:12
4       2020-11-05 17:30:29

How can I get return only, in date type.

df['date']
2020-12-01
2020-11-11
2020-11-10
mk2080
  • 872
  • 1
  • 8
  • 21
  • 2
    `df['date_utc'].dt.date` <---- – Pygirl Dec 19 '20 at 15:57
  • 1
    Does this answer your question? [Keep only date part when using pandas.to\_datetime](https://stackoverflow.com/questions/16176996/keep-only-date-part-when-using-pandas-to-datetime) – skuzzy Dec 19 '20 at 16:02

0 Answers0