-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fixed issue with read_json and partially missing MI names #19177
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
doc/source/io.rst
Outdated
name. | ||
Please note that the literal string 'index' as the name of an ``Index`` is not | ||
round-trippable, nor are any names beginning with 'level_' within a | ||
``MultiIndex``. These are used by default in ``write_json`` to indicate missing |
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 use :class`Index`
and :func:`DataFrame.to_json`
(you mean that instead of write_json I think)
names=('foo', 'level_1')) | ||
]) | ||
def test_warns_non_roundtrippable_names(self, idx): | ||
df = pd.DataFrame([[]], index=idx) |
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.
add the issue number here
95b2a99
to
1306b0e
Compare
Codecov Report
@@ Coverage Diff @@
## master #19177 +/- ##
==========================================
- Coverage 91.53% 91.52% -0.01%
==========================================
Files 147 148 +1
Lines 48797 48784 -13
==========================================
- Hits 44664 44648 -16
- Misses 4133 4136 +3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #19177 +/- ##
==========================================
- Coverage 91.55% 91.53% -0.03%
==========================================
Files 147 147
Lines 48812 48818 +6
==========================================
- Hits 44690 44684 -6
- Misses 4122 4134 +12
Continue to review full report at Codecov.
|
1306b0e
to
3c9ff1d
Compare
``Index``, this function sets the name of the returned ``DataFrame`` to | ||
``None`` when said string is encountered. Therefore, intentional usage | ||
of `index` as the ``Index`` name is not supported. | ||
Because :func:`DataFrame.to_json` uses the string 'index' to denote a |
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.
how much would we break if we used something like what we do in parquet, e.g. __index_level_0__
or something 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.
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.
Yes, I was thinking about that too. It'd be nice to standardize these at some point, and the sooner the better (doesn't have to be here though. I'll open a new issue).
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.
yeah ok makes sense (and actually we could have back compat on this)
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.
lgtm. just asking the question above. |
thanks @WillAyd @TomAugspurger will open a new issue to discuss |
git diff upstream/master -u -- "*.py" | flake8 --diff