API: raise notImplementedError on to_json(orient='table') for a DataFrame with a MultiIndex
State: closed

xref #15996


Labels:
name: Output-Formatting
description: __repr__ of pandas objects, to_string
name: IO JSON
description: read_json, to_json, json_normalize

Comments:
@TomAugspurger 

I guess should do this for now (unless you can fix :>)
Yeah, probably best, at least for now...

Let's leave the issue open though, and relabel it as a general "what should the tableschema repr provide when all else fails"
cc @rgbkrk 
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=h1) Report
> Merging [#16095](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f0bd908336a260cafa9d83c8244dd1a0a056f72d?src=pr&el=desc) will **decrease** coverage by `50.48%`.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16095/graphs/tree.svg?token=eZ4WkYLtcO&width=650&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##           master   #16095       +/-   ##
===========================================
- Coverage   90.84%   40.35%   -50.49%     
===========================================
  Files         159      159               
  Lines       50776    50777        +1     
===========================================
- Hits        46128    20492    -25636     
- Misses       4648    30285    +25637
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `?` | |
| #single | `40.35% <50%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/json/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vanNvbi5weQ==) | `17.27% <50%> (-73.01%)` | :arrow_down: |
| [pandas/formats/style.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2Zvcm1hdHMvc3R5bGUucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/sas/sas\_constants.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfY29uc3RhbnRzLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2pzb24ucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/parser.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL3BhcnNlci5weQ==) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tslib.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL3RzbGliLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/io/sas/sas7bdat.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXM3YmRhdC5weQ==) | `0% <0%> (-90.67%)` | :arrow_down: |
| [pandas/io/sas/sas\_xport.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nhcy9zYXNfeHBvcnQucHk=) | `0% <0%> (-90.28%)` | :arrow_down: |
| [pandas/core/tools/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvdG9vbHMvbnVtZXJpYy5weQ==) | `10.44% <0%> (-89.56%)` | :arrow_down: |
| [pandas/io/json/normalize.py](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vbm9ybWFsaXplLnB5) | `8.16% <0%> (-88.78%)` | :arrow_down: |
| ... and [111 more](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=footer). Last update [f0bd908...908d0f0](https://codecov.io/gh/pandas-dev/pandas/pull/16095?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Thanks, seems sensible. This should end up spitting out HTML while also throwing the exception, which should be fine. They'll have to toggle off the table schema mode.