-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Table Schema bombs with MultiIndex #15996
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
Comments
Right... I think I knew about this and forgot to handle it. I think the issue is that the spec wants the field names to be a string. We would probably represent this as a tuple. So we can do this, it just means we won't be compliant. Thoughts? I guess we could have a strict mode that would raise in cases like this? But for use-cases like sending data to nteract, we don't really want to raise an exception, so we'd be laxer. |
Ah right, I remember a little bit of chatter on this. I think it would be ok to only put out an HTML table in cases like these, I'd prefer compliance over niceties for multiindex. We can move specs forward over time. /cc @pwalsh |
Oh, we also generate invalid JSON with a MultiIndex in the columns 😬 #15273. Don't think I'll have time to get to that before the release. If you think falling back in these cases is appropriate, I'll put that logic in the publish part. Another option is to serialize all the level names down to a string like |
There were indeed still a bunch of cases where the json schema generation errors, see the list in the PR: #14904 (comment) (and multi-index columns is one of them). We should probably open an issue for those (or use this one as the general follow-up issue). |
we could add a |
…rame with a column MultiIndex closes pandas-dev#15996
@rgbkrk what's the ideal behavior here, as far as front-ends are concerned? Do you want us to just not hava a |
Yeah, just don't have the |
As for another channel, are you asking about where to send errors to? |
Yeah, my memory is a bit hazy, but I thought there were other channels to publish errors. It looks like I was misremembering though. Is there some way to notify you that vnd.dataresource+json version failed? |
Warning on stderr will be printed in red in classic notebook. (I believe it should be yellow because red is scary). An error will stop the execution while just printing on stderr is considered as just "text" and the notebook should keep on processing as planned. Does that answer your question ? |
I think so, thanks. I'll emit a warning when we fail to serialize the object, and publish just the text and html reprs. |
…rame with a column MultiIndex (pandas-dev#16095) closes pandas-dev#15996
Using the new (ok, yet to be released) table schemaized with the generated MultiIndex as mentioned in #15379, I noticed that it creates a traceback (and falls back on HTML)
Code Sample
Problem description
Full Traceback
The key line in there is
expected list, got FrozenList
fromarrays = list(lib.to_object_array_tuples(tuples).T)
The text was updated successfully, but these errors were encountered: