-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Added append functionality for DataFrame.to_json #48540
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
Conversation
… supported when lines=True and orient='records'.
…ser_guide, and generic docstring.
To json append mode
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
…rsion per request from mroeschke.
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 fairly good. Possibly some typing issues: https://github.com/pandas-dev/pandas/actions/runs/3055197193/jobs/4927985921
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
@mroeschke Is there anything that I need to do for this PR? or are we just waiting for the right time to merge it in? |
Looks like this needs a rebase and there are still typing errors: https://github.com/pandas-dev/pandas/actions/runs/3057060394/jobs/4931831550 |
… supported when lines=True and orient='records'.
…ser_guide, and generic docstring.
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
To json append mode
@mroeschke I'm still unsure about this typing issue that it's failing. Could you help me out with that? Also, I realize I need to adjust which whatsnew file i'm changing so just let me know which one I need to add it to and I'll do that. Not sure why 1.6.0 is showing as a completely new file on my commit... |
The overloads in Yeah the |
… removing whatsnew 1.6.0
To json append mode
@mroeschke Looks like that fixed the docstring issue. Now I'm just unsure of what whatsnew to put the enhancement information in. |
You can put it in |
To json append mode
@mroeschke Finished. Let me know if there's anything else that I need to do. |
Thanks for sticking with this @SFuller4! |
Thanks for the assistance @mroeschke! Next time should be smoother haha |
* Adding functionality for mode='a' when saving DataFrame.to_json. Only supported when lines=True and orient='records'. * Adding tests for append functionality, along with updated whatsnew, user_guide, and generic docstring. * pre-commit adjustments * Update pandas/io/json/_json.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * Fixing pytest cases per request from mroeschke. Switching whatsnew version per request from mroeschke. * removed repr() from ValueError msg * fixing bad formatting * Adjusting Typing from str to Literal["a", "w"] per request. * updating typing issues in the core file * Adding functionality for mode='a' when saving DataFrame.to_json. Only supported when lines=True and orient='records'. * Adding tests for append functionality, along with updated whatsnew, user_guide, and generic docstring. * pre-commit adjustments * Update pandas/io/json/_json.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * fixing typing issues by adding mode to the overloads of to_json. Also removing whatsnew 1.6.0 * moving enhancement information to whatsnew/v2.0.0 * removing extra space from old whatsnew Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
* Adding functionality for mode='a' when saving DataFrame.to_json. Only supported when lines=True and orient='records'. * Adding tests for append functionality, along with updated whatsnew, user_guide, and generic docstring. * pre-commit adjustments * Update pandas/io/json/_json.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * Fixing pytest cases per request from mroeschke. Switching whatsnew version per request from mroeschke. * removed repr() from ValueError msg * fixing bad formatting * Adjusting Typing from str to Literal["a", "w"] per request. * updating typing issues in the core file * Adding functionality for mode='a' when saving DataFrame.to_json. Only supported when lines=True and orient='records'. * Adding tests for append functionality, along with updated whatsnew, user_guide, and generic docstring. * pre-commit adjustments * Update pandas/io/json/_json.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * fixing typing issues by adding mode to the overloads of to_json. Also removing whatsnew 1.6.0 * moving enhancement information to whatsnew/v2.0.0 * removing extra space from old whatsnew Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
append mode
to JSON lines #35849doc/source/whatsnew/v1.5.0.rst
file if fixing a bug or adding a new feature.Added new a new keyword argument (mode) to DataFrame.to_json(). Strictly only takes 'w' and 'a' as inputs, defaulting to 'w'. mode='a' is only supported when lines is True and orient is 'records'. This enhancement only effects to_json when a path_or_buf is supplied, otherwise it returns the json dump like expected, however, checks will occur when mode='a' regardless of whether path_or_buf is supplied.