Skip to content

CLN: display.notebook_repr_html -> display.html.notebook (GH11784) #20396

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ display.memory_usage True This specifies if the memor
display.multi_sparse True "Sparsify" MultiIndex display (don't
display repeated elements in outer
levels within groups)
display.notebook_repr_html True When True, IPython notebook will
display.html.notebook True When True, IPython notebook will
use html representation for
pandas objects (if it is available).
display.pprint_nest_depth 3 Controls the number of nested levels
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ Deprecations

- ``pandas.tseries.plotting.tsplot`` is deprecated. Use :func:`Series.plot` instead (:issue:`18627`)
- ``Index.summary()`` is deprecated and will be removed in a future version (:issue:`18217`)
- ``pd.options.display.notebook_repr_html`` is deprecated in favor of ``pd.options.display.html.notebook`` (:issue:`11784`)

.. _whatsnew_0230.prior_deprecations:

Expand Down
14 changes: 12 additions & 2 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,17 @@ def use_numexpr_cb(key):
per column information will be printed.
"""

pc_nb_repr_h_doc = """
html_notebook_doc = """
: boolean
When True, IPython notebook will use html representation for
pandas objects (if it is available).
"""

pc_nb_repr_h_deprecation_warning = """
display.notebook_repr_html has been deprecated,
use display.html.notebook instead
"""

pc_date_dayfirst_doc = """
: boolean
When True, prints and parses dates with the day first, eg 20/01/2005
Expand Down Expand Up @@ -322,7 +327,7 @@ def table_schema_cb(key):
validator=is_int)
cf.register_option('colheader_justify', 'right', colheader_justify_doc,
validator=is_text)
cf.register_option('notebook_repr_html', True, pc_nb_repr_h_doc,
cf.register_option('notebook_repr_html', True, html_notebook_doc,
validator=is_bool)
cf.register_option('date_dayfirst', False, pc_date_dayfirst_doc,
validator=is_bool)
Expand Down Expand Up @@ -366,6 +371,8 @@ def table_schema_cb(key):
validator=is_int)
cf.register_option('html.use_mathjax', True, pc_html_use_mathjax_doc,
validator=is_bool)
cf.register_option('html.notebook', True, html_notebook_doc,
validator=is_bool)

with cf.config_prefix('html'):
cf.register_option('border', 1, pc_html_border_doc,
Expand All @@ -374,6 +381,9 @@ def table_schema_cb(key):
cf.deprecate_option('html.border', msg=pc_html_border_deprecation_warning,
rkey='display.html.border')

cf.deprecate_option('display.notebook_repr_html',
msg=pc_nb_repr_h_deprecation_warning,
rkey='display.html.notebook')

tc_sim_interactive_doc = """
: boolean
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def _repr_html_(self):
val = val.replace('>', r'>', 1)
return '<pre>' + val + '</pre>'

if get_option("display.notebook_repr_html"):
if get_option("display.html.notebook"):
max_rows = get_option("display.max_rows")
max_cols = get_option("display.max_columns")
show_dimensions = get_option("display.show_dimensions")
Expand Down
11 changes: 9 additions & 2 deletions pandas/tests/io/formats/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def test_to_string_line_width_no_index(self):
def test_to_string_float_formatting(self):
tm.reset_display_options()
fmt.set_option('display.precision', 5, 'display.column_space', 12,
'display.notebook_repr_html', False)
'display.html.notebook', False)

df = DataFrame({'x': [0, 0.25, 3456.000, 12e+45, 1.64e+6, 1.7e+8,
1.253456, np.pi, -1e6]})
Expand Down Expand Up @@ -1421,7 +1421,7 @@ def test_repr_html(self):
fmt.set_option('display.max_rows', 1, 'display.max_columns', 1)
self.frame._repr_html_()

fmt.set_option('display.notebook_repr_html', False)
fmt.set_option('display.html.notebook', False)
self.frame._repr_html_()

tm.reset_display_options()
Expand Down Expand Up @@ -1651,6 +1651,13 @@ def test_period(self):
"3 2013-04 2011-04 d")
assert str(df) == exp

@tm.capture_stdout
def test_option_notebook_repr_html_deprecated(self):
# GH11784
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
pd.options.display.notebook_repr_html


def gen_series_formatting():
s1 = pd.Series(['a'] * 100)
Expand Down