Skip to content
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

DEPR: deprecate html.border option #16970

Merged
merged 1 commit into from
Jul 16, 2017
Merged
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 @@ -400,7 +400,7 @@ display.width 80 Width of the display in charact
display.html.table_schema False Whether to publish a Table Schema
representation for frontends that
support it.
html.border 1 A ``border=value`` attribute is
display.html.border 1 A ``border=value`` attribute is
inserted in the ``<table>`` tag
for the DataFrame HTML repr.
io.excel.xls.writer xlwt The default Excel writer engine for
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Deprecations
~~~~~~~~~~~~
- :func:`read_excel()` has deprecated ``sheetname`` in favor of ``sheet_name`` for consistency with ``.to_excel()`` (:issue:`10559`).

- ``pd.options.html.border`` has been deprecated in favor of ``pd.options.display.html.border`` (:issue:`15793`).

.. _whatsnew_0210.prior_deprecations:

Expand Down
22 changes: 16 additions & 6 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@ def use_numexpr_cb(key):
(default: False)
"""

pc_html_border_doc = """
: int
A ``border=value`` attribute is inserted in the ``<table>`` tag
for the DataFrame HTML repr.
"""

pc_html_border_deprecation_warning = """\
html.border has been deprecated, use display.html.border instead
(currently both are identical)
"""

pc_line_width_deprecation_warning = """\
line_width has been deprecated, use display.width instead (currently both are
identical)
Expand Down Expand Up @@ -381,6 +392,8 @@ def table_schema_cb(key):
validator=is_bool)
cf.register_option('html.table_schema', False, pc_table_schema_doc,
validator=is_bool, cb=table_schema_cb)
cf.register_option('html.border', 1, pc_html_border_doc,
validator=is_int)


cf.deprecate_option('display.line_width',
Expand All @@ -390,16 +403,13 @@ def table_schema_cb(key):
cf.deprecate_option('display.height', msg=pc_height_deprecation_warning,
rkey='display.max_rows')

pc_html_border_doc = """
: int
A ``border=value`` attribute is inserted in the ``<table>`` tag
for the DataFrame HTML repr.
"""

with cf.config_prefix('html'):
cf.register_option('border', 1, pc_html_border_doc,
validator=is_int)

cf.deprecate_option('html.border', msg=pc_html_border_deprecation_warning,
rkey='display.html.border')


tc_sim_interactive_doc = """
: boolean
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ def __init__(self, formatter, classes=None, max_rows=None, max_cols=None,
self.max_cols < len(self.fmt.columns))
self.notebook = notebook
if border is None:
border = get_option('html.border')
border = get_option('display.html.border')
self.border = border

def write(self, s, indent=0):
Expand Down
7 changes: 6 additions & 1 deletion pandas/tests/io/formats/test_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,7 @@ def test_to_html_border(self):

def test_to_html_border_option(self):
df = DataFrame({'A': [1, 2]})
with pd.option_context('html.border', 0):
with pd.option_context('display.html.border', 0):
result = df.to_html()
assert 'border="0"' in result
assert 'border="0"' in df._repr_html_()
Expand All @@ -1411,6 +1411,11 @@ def test_to_html_border_zero(self):
result = df.to_html(border=0)
assert 'border="0"' in result

def test_display_option_warning(self):
with tm.assert_produces_warning(DeprecationWarning,
check_stacklevel=False):
pd.options.html.border

def test_to_html(self):
# big mixed
biggie = DataFrame({'A': np.random.randn(200),
Expand Down