-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
API: Styler.hide_columns replaced by .hide_values which also operates row-wise
#41158
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
| self.hidden_columns = hcols # type: ignore[assignment] | ||
| return self.hide_values(subset) | ||
|
|
||
| def hide_values(self, subset, axis: Axis = "columns", show: bool = False) -> Styler: |
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.
i find this a very confusing name, hide_axis is more appropriate
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.
The trick is to distinguish between the cases of:
a) hiding select rows or columns of data (whilst other index keys or column headers are visible),
b) or displaying the data values but just hiding the index or column headers row in their entirety.
Currently hide_columns does a) whilst hide_index does b). The complete idea was that:
i) hide_values would do a) for either the index or columns axes.
ii) hide_headers (a new method) would do b) for either the index or columns axes.
?
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.
| return self.hide_values(subset) | ||
|
|
||
| def hide_values(self, subset, axis: Axis = "columns", show: bool = False) -> Styler: | ||
| """ |
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.
i wouldn't make this user visible instead prefer hide_index, hide_columns (this can be the impl)
|
closing this is favour of #41266 for now. |
For showing and hiding columns/rows
Stylercurrently has two methods:.hide_columns(subset): which hides a selection of columns and the associated data values..hide_index(): which hides the index keys completely and displays all the data values.This PR adds a
.hide_values(subset, axis, show)method, which is a superset of.hide_columns. It allows the same functionality to operate row-wise, and adds the kwargshowwhich allows an inverse method, exclusively showing instead of hiding.Follow-on:
Option 1
Keep
.hide_values(subset, axis, show)as is and deprecate.hide_columns.Option 2
Make
._hide_values(subset, axis, show)a private module and include/add the public methods: