8000 ENH: `Styler.relabel_index` for directly specifying display of index labels by attack68 · Pull Request #47864 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: Styler.relabel_index for directly specifying display of index labels #47864

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

Merged
merged 7 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
DOC: edit
  • Loading branch information
attack68 committed Jul 26, 2022
commit d59138e3757f955f2389d4306c3c68c48d3d74b5
1 change: 1 addition & 0 deletions doc/source/reference/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Style application
Styler.applymap_index
Styler.format
Styler.format_index
Styler.relabel_index
Styler.hide
Styler.concat
Styler.set_td_classes
Expand Down
5 changes: 2 additions & 3 deletions pandas/io/formats/style_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,11 +1395,10 @@ def relabel_index(

.. code-block:: python

# relabel first, then hide
df = pd.DataFrame({"col": ["a", "b", "c"]})
df.style.relabel_index(["A", "B", "C"]).hide([0,1])

.. code-block:: python

# hide first, then relabel
df = pd.DataFrame({"col": ["a", "b", "c"]})
df.style.hide([0,1]).relabel_index(["C"])

Expand Down
0