-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Restore return value in notebook reprs #16171
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
Monkey patches the _ipython_display_ method onto NDFrame, so that notebook cells have a real return value. Setting the display.html.table_schema will monkey patch the method on, and remove it when unset. closes ipython/ipython#10491
pandas/core/config_init.py
Outdated
@@ -307,6 +307,48 @@ def mpl_style_cb(key): | |||
return val | |||
|
|||
|
|||
def table_schema_cb(key): | |||
# Having _ipython_display_ defined messes with the return value | |||
# from cells, so the Out[x] dicitonary breaks. |
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.
don't write the full method here
instead inside the cb import a method a call it
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.
actually i would create this dynamically
simply define 2 methods and have the cb just set one of them
we do in set_use_numexpr just like 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.
would not create dynamically (typo)
Codecov Report
@@ Coverage Diff @@
## master #16171 +/- ##
==========================================
+ Coverage 90.86% 90.88% +0.02%
==========================================
Files 162 162
Lines 50819 50826 +7
==========================================
+ Hits 46177 46195 +18
+ Misses 4642 4631 -11
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16171 +/- ##
==========================================
+ Coverage 90.86% 90.88% +0.02%
==========================================
Files 162 162
Lines 50819 50827 +8
==========================================
+ Hits 46177 46195 +18
+ Misses 4642 4632 -10
Continue to review full report at Codecov.
|
return None | ||
|
||
# Series doesn't define _repr_html_ or _repr_latex_ | ||
latex = self._repr_latex_() if hasattr(self, '_repr_latex_') else None |
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.
maybe we should define his for Series (trivial version) to avoid this kind of logic
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.
@jreback look ok to you? |
yep |
* BUG: Restore return value in notebook reprs Monkey patches the _ipython_display_ method onto NDFrame, so that notebook cells have a real return value. Setting the display.html.table_schema will monkey patch the method on, and remove it when unset. closes ipython/ipython#10491 * Define in generic.py * PEP8
* BUG: Restore return value in notebook reprs Monkey patches the _ipython_display_ method onto NDFrame, so that notebook cells have a real return value. Setting the display.html.table_schema will monkey patch the method on, and remove it when unset. closes ipython/ipython#10491 * Define in generic.py * PEP8
Monkey patches the ipython_display method onto NDFrame, so that
notebook cells have a real return value. Setting the
display.html.table_schema will monkey patch the method on,
and remove it when unset.
closes ipython/ipython#10491