Skip to content

CLN: catch stricter in json #28351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 10, 2019
Merged

CLN: catch stricter in json #28351

merged 3 commits into from
Sep 10, 2019

Conversation

jbrockmendel
Copy link
Member

@WillAyd think there is a compelling reason to keep this as break instead of lumping it into the continue clause above?

(obviously the TODO comment will be removed/resolved before merge)

@WillAyd
Copy link
Member

WillAyd commented Sep 9, 2019

Not that I know of. Probably OK to consolidate with exception above

@WillAyd WillAyd added Clean IO JSON read_json, to_json, json_normalize labels Sep 9, 2019
@WillAyd WillAyd added this to the 1.0 milestone Sep 10, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -972,10 +972,8 @@ def _try_convert_to_date(self, data):
for date_unit in date_units:
try:
new_data = to_datetime(new_data, errors="raise", unit=date_unit)
except ValueError:
except (ValueError, OverflowError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually should we be catching an OutOfBoundsDatetime exception here? Not sure if test coverage is hitting that but I think easy enough to trigger (just try a date like "9999-01-01")

Out of curiosity what causes the OverflowError?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is cast_to_unit being called inside array_to_datetime, but would have to check.

OutOfBoundsDatetime subclasses ValueError so that is already caught.

@jreback
Copy link
Contributor

jreback commented Sep 10, 2019

lgtm.

@WillAyd WillAyd merged commit ae22b80 into pandas-dev:master Sep 10, 2019
@WillAyd
Copy link
Member

WillAyd commented Sep 10, 2019

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the faster4 branch September 10, 2019 20:52
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants