Skip to content

reprs no longer return anything in the notebook #16168

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

Closed
TomAugspurger opened this issue Apr 28, 2017 · 6 comments
Closed

reprs no longer return anything in the notebook #16168

TomAugspurger opened this issue Apr 28, 2017 · 6 comments
Labels
Output-Formatting __repr__ of pandas objects, to_string
Milestone

Comments

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Apr 28, 2017

In #14904 I added an NDFrame._ipython_display_, which handles publishing what the user has configured (html, table schema, latex, text).

An unintended consequence of that, is that our DataFrame and Series reprs invoked by the notebook no longer return anything, so there's no Out[x] and nothing is stored in the Out dictionary. Here's a comparison notebook.

cc @rgbkrk

For the jupyter folks (maybe @Carreau if you have time), is there any way around this? Does using _ipython_display_ mean you can't have a "real output" from a cell?

@TomAugspurger TomAugspurger added this to the 0.20.0 milestone Apr 28, 2017
@Carreau
Copy link
Contributor

Carreau commented Apr 28, 2017

For the jupyter folks (maybe @Carreau if you have time), is there any way around this? Does using ipython_display mean you can't have a "real output" from a cell?

Hum, I don't know. That's an interesting question. I'm unsure if there is a way to have a _repr_ that just compute all mime bundles and return this.

@TomAugspurger
Copy link
Contributor Author

I can raise an issue on the Jupyter side (IPython repo probably?) if necessary.

@Carreau
Copy link
Contributor

Carreau commented Apr 28, 2017

Sure, that would be great !

@TomAugspurger
Copy link
Contributor Author

Since _repr_table_schema_ is the only one who really needs _ipython_display_, we could monkeypatch the current _ipython_display_ onto NDFrame when the user sets pd.options.display.html.table_schema to True, and remove it when they set it to False (the default).

The default is False, so users who don't explicitly set that config value will get the Out[x] as before. Not a long-term solution, but perhaps good enough for now?

@jreback jreback added the Output-Formatting __repr__ of pandas objects, to_string label Apr 28, 2017
@rgbkrk
Copy link
Contributor

rgbkrk commented Apr 29, 2017

Yeah I definitely didn't intend for us to break previous workflows. The monkey patching seems ok for now. It's too bad we don't have ipython/ipython#10090.

@TomAugspurger
Copy link
Contributor Author

Closed by ipython/ipython#10491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

4 participants