-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fixed encoding of pd.NA with to_json #31748
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1671,3 +1671,11 @@ def test_to_s3(self, s3_resource): | |
assert target_file in ( | ||
obj.key for obj in s3_resource.Bucket("pandas-test").objects.all() | ||
) | ||
|
||
@pytest.mark.parametrize( | ||
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. I think the comment around parametrization got lost in GH comments but in any case would rather parametrize on I don't think the current parametrization is super useful, so OK to just take the first case and put it in the body of the test 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.
+1 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. Couldn't find a way to add Note that |
||
"dataframe,expected", [(pd.DataFrame([[pd.NA]]), '{"0":{"0":null}}',)], | ||
WillAyd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
def test_json_pandas_na(self, dataframe, expected): | ||
# GH 31615 | ||
result = dataframe.to_json() | ||
assert result == expected |
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.
Thanks @ArtificialQualia
This should be
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.
@MarcoGorelli I've updated that to the correct format.
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 original was actually fine, to be consistent with the v1.0.1 file
(sorry for the conflicting comments)
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.
My mistake, sorry, I'd taken that from v1.1.0 where we go back to
, will be more careful in the future
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.
@MarcoGorelli no problem! It's also inconsistent between the different files .. (for the bug fix releases, the list of bugs is much smaller, so less worth it to make subsections. At least, that is what we just did for the v1.0.1 file)
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.
Reverted to original format