I am unable to convert my date column from my data frame from a string to date format. I've tried using the lambda date conversion code in the image above, as well as a few other methods and I can't seem to make it work. It appears to possibly be because my 'variable' column does not appear to be like the rest of the columns (I think that it is maybe "indexed?"). Help would be much appreciate!
Asked
Active
Viewed 719 times
-1
-
Possible duplicate of [How to convert string to datetime format in pandas python?](https://stackoverflow.com/questions/32204631/how-to-convert-string-to-datetime-format-in-pandas-python) – jpp Feb 17 '18 at 19:31
-
@Josh... all your comments are edits I assume... modify your question and remove your comments. Also..start your question with text and not "empty line text for image". It looks silly. Cheers. – ZF007 Feb 17 '18 at 21:22
1 Answers
1
Use to_datetime
:
Hotsprings2['variable'] = pd.to_datetime(Hotsprings2['variable'], format='%Y-%m-%d')

jezrael
- 822,522
- 95
- 1,334
- 1,252
-
sorry everyone for the unclean post. Not all the images that I uploaded came through on the post. This worked when I applied it to my first block of code instead of my 4th block. Thanks Jezrael – Josh Feb 17 '18 at 19:11