pandas
pandas copied to clipboard
Added improvements in to_datetime Error reporting message - incorrect field today/now shown in error
- closes #47495
Splitting changes from #47597, This PR aims to close the bug #47495
-
Changes description
- For issue #47495- made change in
pandas/_libs/tslib.pyxto accept "now" and "today" values. These values are accepted in other areas of parsing (_parse_today_nowinpandas/_libs/tslib.pyx)
- For issue #47495- made change in
-
Example of changed error messages
Code Old Error ( on 1.4.3 ) New Error pd.to_datetime(["today", "yesterday"]) dateutil.parser._parser.ParserError: Unknown string format: today dateutil.parser._parser.ParserError: Unknown string format: yesterday present at position 1
hi @mroeschke, could you please review this change whenever possible ? Above change does the trick, but not sure if anything else needs to be considered here ( in terms of other existing usecases, etc ) Thanks in advance
Thanks @dannyi96