-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: make JSONTableWriter fail if no index.name and 'index' in columns #58985
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
mroeschke
merged 2 commits into
pandas-dev:main
from
taranarmo:make-jsontablewriter-fail-if-empty-index-name-and-index-is-a-column-name
Jul 8, 2024
Merged
BUG: make JSONTableWriter fail if no index.name and 'index' in columns #58985
mroeschke
merged 2 commits into
pandas-dev:main
from
taranarmo:make-jsontablewriter-fail-if-empty-index-name-and-index-is-a-column-name
Jul 8, 2024
Conversation
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
mroeschke
reviewed
Jul 8, 2024
mroeschke
reviewed
Jul 8, 2024
mroeschke
reviewed
Jul 8, 2024
doc/source/user_guide/io.rst
Outdated
@@ -2287,6 +2287,8 @@ Please note that the literal string 'index' as the name of an :class:`Index` | |||
is not round-trippable, nor are any names beginning with ``'level_'`` within a | |||
:class:`MultiIndex`. These are used by default in :func:`DataFrame.to_json` to | |||
indicate missing values and the subsequent read cannot distinguish the intent. | |||
The string 'index' as a column name with empty :class:`Index` or if it is |
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 this to the docstring instead?
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.
Added to the docstring into index keyword section
cf81d79
to
bf97c6a
Compare
This commit is itended to fix GH pandas-dev#58925. If index.name is empty it will use set_default_names inside __init__ to make check on overlapping names fail. Otherwise it's done during schema creation and not reflected on the dataframe itself which creates inconsistency between the data and its schema. add mention of the raised error to the `to_json` documentation move new logic description from IO docs to to_json docstring
bf97c6a
to
7d772d5
Compare
mroeschke
reviewed
Jul 8, 2024
Rephrase the what's new addition Co-authored-by: Matthew Roeschke <[email protected]>
mroeschke
approved these changes
Jul 8, 2024
Thanks @taranarmo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This commit is intended to fix GH #58925. If index.name is empty it will use set_default_names inside init to make check on overlapping names fail. Otherwise it's done during schema creation and not reflected on the dataframe itself which creates inconsistency between the data and its schema.
Probably new behavior should be mentioned in the
to_json
docs? I added the docs change as a separate commit to ease squashing or reverting.doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.