Do not manually loop over all rows when encoding a dataframe as JSON
See original GitHub issueSee: https://github.com/pydata/pandas-gbq/pull/25#discussion_r155355165
Currently the code loops over each row to encode it as JSON. This could be sped up by calling to_json() on the whole dataframe instead.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Do not manually loop over all rows when encoding a ... - GitHub
Do not manually loop over all rows when encoding a dataframe as JSON #96 ... Currently the code loops over each row to...
Read more >placing try-except with for loop to avoid errors reading text file
Goal: I want to essentially skip any lines in the JSON file that are problematic, but add any I can to my pandas...
Read more >How to convert pandas DataFrame into JSON in Python?
Convert pandas DataFrame into JSON ; path_or_buf, string or filename, optional, File path or object. If not specified, the result is returned as ......
Read more >pandas.DataFrame.to_json — pandas 1.5.2 documentation
Encoding /decoding a Dataframe using 'records' formatted JSON. Note that index labels are not preserved with this encoding.
Read more >Pandas - Convert DataFrame to JSON String
You can convert pandas DataFrame to JSON string by using DataFrame.to_json() method. This method takes a very important param orient which ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Looks like something like this should work to avoid having to write to a temporary file.
CSV also smaller! And no nesting possible so no loss there
But if json is preferred, I think you can use
orient=records