-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: #31464 Fix error when parsing JSON list of bool into Series #33373
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
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
395a7fc
BUG: #31464 Fix error when parsing JSON list of bool into Series
jessefarnham 96e2a0b
Code review feedback: don't even try to convert bool to date
jessefarnham b90ad78
update comment
jessefarnham 0665127
After discussion, go back to original approach
jessefarnham 19097a7
Move test
jessefarnham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,3 +179,9 @@ def test_readjson_unicode(monkeypatch): | |
result = read_json(path) | ||
expected = pd.DataFrame({"£©µÀÆÖÞßéöÿ": ["АБВГДабвгд가"]}) | ||
tm.assert_frame_equal(result, expected) | ||
|
||
|
||
def test_readjson_bool_series(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
result = read_json("[true, true, false]", typ="series") | ||
expected = pd.Series([True, True, False]) | ||
tm.assert_series_equal(result, expected) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment inside the if
# GH#33373 ignore bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Test failures appear to be unrelated; the FDIC site that the html tests use is returning intermittent 404s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm actually not sure about doing it this way; we've done this type of checking in groupby and its not a great precedent. We do already catch the three errors a few lines above this - shouldn't we just do the same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first approach seems a bit simpler to me—this seems to be a case where whoever put the TypeError into the other except clauses accidentally omitted it from the one that I originally added it to. Let me know what you and @jbrockmendel decide and I’ll be happy to update accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im happy to defer to @WillAyd in this part of the code. catching TypeError is definitely more idiomatic python, but we've definitely seen how catching too much has let bugs remain un-surfaced for a long time elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I think should catch the TypeError as done originally; would match what we have on L968 anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good -- pushed the revert back to the original change. Thanks for the quick turnaround -- let me know if anything else needed.