0

I am trying to convert a column "col1" to datetime format in a dataframe. "col1" has date values as strings with date format like "2021-10-01 00:00:00". The code I am using is:

data['Output']=pd.to_datetime(data['col1'],format='%Y-%m-%d %H:%M:%S')

But while doing so, the date values in "Output" column are coming like this "2021-10-01T00:00:00.000000000". I don't know what is this T value in the date, and I don't want to have it in my data. I only want date and timestamp. How can I resolve this issue?

FObersteiner
  • 22,500
  • 8
  • 42
  • 72
DumbCoder
  • 233
  • 2
  • 9
  • [Can't reproduce](https://akuiper.com/console/LT3-xUHeJCLg). Which pandas version are you using ? – Psidom Feb 18 '22 at 04:38
  • What is T? => https://stackoverflow.com/questions/29281935/what-exactly-does-the-t-and-z-mean-in-timestamp/29282022 It is standard character and many language can parse this T fine, but if you want to remove it, as @Psidom said, let us know your env info. – Emma Feb 18 '22 at 04:49
  • Could you please clarify what you mean by "*the date values in "Output"*" - do you save the dataframe e.g. to a file? – FObersteiner Feb 18 '22 at 06:31

0 Answers0