-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[BUG] handle } in line delimited json #14391
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
Closed
Closed
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
58074fd
fix for quoted special characters
9b150b5
fix typo in expected output
d2724d3
added whatsnew entry
3a9dd5d
added asv benchmark
3560a8e
added whitespace
2aefa85
handle double quotes in strings
444e6c2
fix typo
be43f39
fixed string formatting
edb1488
lint
8b057ff
remove duplicate and assert round_trip works
8591cb9
remove duplicated code
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
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 |
---|---|---|
|
@@ -962,6 +962,12 @@ def test_to_jsonl(self): | |
expected = '{"a":1,"b":2}\n{"a":1,"b":2}' | ||
self.assertEqual(result, expected) | ||
|
||
df = DataFrame([["foo}", "bar"], ['foo"', "bar"]], columns=['a', 'b']) | ||
result = df.to_json(orient="records", lines=True) | ||
expected = '{"a":"foo}","b":"bar"}\n{"a":"foo\\"","b":"bar"}' | ||
self.assertEqual(result, expected) | ||
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 also round trip it and user assert_frame_equal on the result (in addition to the above test) |
||
assert_frame_equal(pd.read_json(result, lines=True), df) | ||
|
||
def test_latin_encoding(self): | ||
if compat.PY2: | ||
self.assertRaisesRegexp( | ||
|
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.
looks like some things got repeated 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.
Looks like self.N/self.C are repeated in most of these classes. Want me to clean them all up?
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.
sure that would be great (you can also make a common base class(s) if that helps as well)
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.
@joshowen you can leave it here as is. I cleaned this up in another PR (@jreback yes I know, I should merge that ...)
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.
ok that's fine (though @joshowen make sure your example doesn't have dups as this is new code)
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.
ah, yes, it is of course OK to remove the lines in this added code that you do not need for this benchmark