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 notebook argument in DataFrame.to_html() #26815

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins added Deprecate Functionality to remove in pandas IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string labels Jun 12, 2019
@WillAyd
Copy link
Member

WillAyd commented Jun 12, 2019

Code looks pretty good. Just to clarify since I'm not super familiar with this one, does this serve any purpose from an end user perspective or is it pure cruft?

Just wondering if we should document the alternatives to this if any

@simonjayhawkins
Copy link
Member Author

Code looks pretty good. Just to clarify since I'm not super familiar with this one, does this serve any purpose from an end user perspective or is it pure cruft?

I'm not sure of the history. Assuming that it was needed internally but added to a public method. So I don't see it serving any purpose to an end user.

Just wondering if we should document the alternatives to this if any

The alternative is the _repr_html_ method. As this is not part of the public API, i'm reluctant to suggest this as an alternative.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the deprecation here: #6581

@@ -495,7 +495,7 @@ Other Deprecations
Use the public attributes :attr:`~RangeIndex.start`, :attr:`~RangeIndex.stop` and :attr:`~RangeIndex.step` instead (:issue:`26581`).
- The :meth:`Series.ftype`, :meth:`Series.ftypes` and :meth:`DataFrame.ftypes` methods are deprecated and will be removed in a future version.
Instead, use :meth:`Series.dtype` and :meth:`DataFrame.dtypes` (:issue:`26705`).

- The ``notebook`` argument of :meth:`DataFrame.to_html` is deprecated (:issue:`23820`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention the replacement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there would be no replacement from an end user perspective. see #26815 (comment)

@@ -650,8 +650,11 @@ def _repr_html_(self):
max_cols = get_option("display.max_columns")
show_dimensions = get_option("display.show_dimensions")

return self.to_html(max_rows=max_rows, max_cols=max_cols,
show_dimensions=show_dimensions, notebook=True)
formatter = fmt.DataFrameFormatter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_repr_html_ just calls to_html with notebook=True, so need to avoid the FutureWarning in the notebook.

eventually i'd like to have _repr_html_ instantiate NotebookFormatter directly and to_html instantiate HTMLFormatter directly. But at the moment neither are subclasses of DataFrameFormatter

@@ -2158,6 +2162,9 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
Convert the characters <, >, and & to HTML-safe sequences.
notebook : {True, False}, default False
Whether the generated HTML is for IPython Notebook.

.. deprecated:: 0.25.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a replacement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there would be no replacement from an end user perspective. see #26815 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this to 1.0.0

@codecov
Copy link

codecov bot commented Jun 12, 2019

Codecov Report

Merging #26815 into master will decrease coverage by 1.41%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26815      +/-   ##
==========================================
- Coverage   91.86%   90.45%   -1.42%     
==========================================
  Files         179      179              
  Lines       50707    50710       +3     
==========================================
- Hits        46584    45870     -714     
- Misses       4123     4840     +717
Flag Coverage Δ
#multiple 90.45% <100%> (ø) ⬆️
#single ?
Impacted Files Coverage Δ
pandas/core/frame.py 96.89% <100%> (-0.12%) ⬇️
pandas/core/computation/pytables.py 62.5% <0%> (-27.75%) ⬇️
pandas/io/pytables.py 63.82% <0%> (-26.48%) ⬇️
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/computation/common.py 84.21% <0%> (-5.27%) ⬇️
pandas/core/computation/expr.py 94.78% <0%> (-3.03%) ⬇️
pandas/io/clipboard/clipboards.py 31.88% <0%> (-2.9%) ⬇️
pandas/io/formats/printing.py 84.49% <0%> (-1.07%) ⬇️
pandas/core/indexes/datetimes.py 96.21% <0%> (-0.17%) ⬇️
pandas/core/arrays/categorical.py 95.8% <0%> (-0.13%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6d27ec...fd23985. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 12, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@7b25463). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #26815   +/-   ##
=========================================
  Coverage          ?   91.86%           
=========================================
  Files             ?      180           
  Lines             ?    50719           
  Branches          ?        0           
=========================================
  Hits              ?    46593           
  Misses            ?     4126           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.45% <100%> (?)
#single 41.12% <25%> (?)
Impacted Files Coverage Δ
pandas/core/frame.py 96.89% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b25463...97dd413. Read the comment docs.

@simonjayhawkins
Copy link
Member Author

add the deprecation here: #6581

done

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment otherwise lgtm

@@ -2158,6 +2162,9 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
Convert the characters <, >, and & to HTML-safe sequences.
notebook : {True, False}, default False
Whether the generated HTML is for IPython Notebook.

.. deprecated:: 0.25.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this to 1.0.0

@WillAyd WillAyd modified the milestones: 0.25.2, 1.0 Aug 28, 2019
@WillAyd
Copy link
Member

WillAyd commented Aug 30, 2019

General question on this - are we adding deprecations to the 1.0.0 release or removing outright?

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Aug 30, 2019 via email

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomAugspurger
Copy link
Contributor

This deprecation docs / warning should have some indication for what users should do instead. What do we recommend?

@simonjayhawkins
Copy link
Member Author

This deprecation docs / warning should have some indication for what users should do instead. What do we recommend?

there would be no replacement from an end user perspective. see #26815 (comment)

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 6, 2019 via email

@jreback
Copy link
Contributor

jreback commented Oct 6, 2019

@simonjayhawkins can you summarize status here

@simonjayhawkins
Copy link
Member Author

there is not agreement that this should be deprecated. so will close and maybe reopen in the future if there is a stronger argument for deprecation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas IO HTML read_html, to_html, Styler.apply, Styler.applymap Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DISC: deprecate notebook parameter in to_html()
4 participants