Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • $\begingroup$ I believe what you suggested works, but it returned "time data '00:02:37 01/01/18' does not match format '%H:%M:%S %m/%d/%Y'. Any idea why? $\endgroup$ Commented Nov 30, 2021 at 13:16
  • $\begingroup$ %Y is for Year with century as a decimal number. Replace it with %y for year without century padded. For a full format guide check this link docs.python.org/3/library/… $\endgroup$ Commented Nov 30, 2021 at 14:26
  • $\begingroup$ Thanks. I��ll work on that later and update you on it. $\endgroup$ Commented Nov 30, 2021 at 14:50
  • $\begingroup$ I did what you suggested and it seemed to have removed the previous error. However, I now get the error: "float() argument must be a string or a number, not 'Timestamp'". I have updated the question to show my code, so maybe you could see something wrong with it. All of the necessary libraries have been imported already. $\endgroup$ Commented Nov 30, 2021 at 22:28
  • $\begingroup$ I looked into it and surrounded the pd.to_datetime() function with a pd.to_numeric() function. That cleared that issue. However, I now have the issue that it cannot convert ' ' to string because there is nothing there in the data value. $\endgroup$ Commented Nov 30, 2021 at 22:34