0

I have in DataFrame in Python columns with name = "col1" with values for example: 2020-10-29 07:33:28 and dtypes of this columns is dtype('O').

My question is how can I convert this column ("col1") so as to have values like: 2020-10-29 instead of 2020-10-29 07:33:28 ? Of course i think that first of all it is neccesairy to convert this column to "datetim64" as I assume.

jack55
  • 97
  • 4

1 Answers1

0

Using strftime you pick the format:

df['col1']=pd.to_datetime(df['col1']).strftime("%Y-%m-%d")
noah
  • 2,496
  • 10
  • 23