Timeline for Cleaning up date strings in Python
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 24, 2018 at 10:03 | history | edited | Daniel | CC BY-SA 4.0 |
Punctuation, edited misleading explanation of dayfirst
|
| Jul 24, 2018 at 9:50 | history | edited | Ludisposed | CC BY-SA 4.0 |
added 7 characters in body
|
| Jul 24, 2018 at 9:38 | comment | added | Ludisposed | @RolfBly I would suggest to look at this answer too you can convert to string easily after you have the date. | |
| Jul 24, 2018 at 9:35 | comment | added | RolfBly |
@Ludisposed I edited the question to clarify why I chose for strings. I will certainly look at dateutil, tho.
|
|
| Jul 24, 2018 at 9:12 | history | edited | 301_Moved_Permanently | CC BY-SA 4.0 |
deleted 2 characters in body
|
| Jul 24, 2018 at 9:10 | history | edited | Ludisposed | CC BY-SA 4.0 |
added 205 characters in body
|
| Jul 24, 2018 at 9:05 | comment | added | Ludisposed |
@MathiasEttinger Which can be avoided by dayfirst=True
|
|
| Jul 24, 2018 at 8:59 | history | edited | Ludisposed | CC BY-SA 4.0 |
added 218 characters in body
|
| Jul 24, 2018 at 8:58 | history | undeleted | Ludisposed | ||
| Jul 24, 2018 at 8:53 | history | deleted | Ludisposed | via Vote | |
| Jul 24, 2018 at 8:49 | comment | added | 301_Moved_Permanently |
Except the dateutil parser (at least using it's default configuration) suffer the same defect than pandas.to_datetime (which could have been used by the OP in the first place if it worked): it will consider '12-10-1887' as the 10th of December, 1887.
|
|
| Jul 24, 2018 at 8:44 | comment | added | RandomDude |
Also using f-strings makes your solution even better :)
|
|
| Jul 24, 2018 at 8:43 | history | edited | Ludisposed | CC BY-SA 4.0 |
added 3 characters in body
|
| Jul 24, 2018 at 8:43 | comment | added | RandomDude |
Variable in except must be called date not d
|
|
| Jul 24, 2018 at 8:34 | history | answered | Ludisposed | CC BY-SA 4.0 |