pandas icon indicating copy to clipboard operation
pandas copied to clipboard

Added improvements in to_datetime Error reporting message - incorrect field today/now shown in error

Open dannyi96 opened this issue 3 years ago • 1 comments

  • 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.pyx to accept "now" and "today" values. These values are accepted in other areas of parsing ( _parse_today_now in pandas/_libs/tslib.pyx )
  • 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

dannyi96 avatar Jul 26 '22 09:07 dannyi96

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

dannyi96 avatar Aug 08 '22 10:08 dannyi96

Thanks @dannyi96

mroeschke avatar Aug 15 '22 17:08 mroeschke