BUG: `Styler.hide_columns()` does not hide index name row
See original GitHub issueWhilst Styler.hide_index()
hides column header name (along with the index), the index name row persists when Styler.hide_columns()
is used to hide column headers.
The index names rows should also be hidden, since currently there is no way to hide it independently.
What to do:
- Find
pandas/io/formats/style_render.py
- Find the method for the
StyleRenderer
called_translate_header
and read the documentation what it is trying to structure. - Go to the section in the method labelled
# 2
and insertself.hide_columns_
into the conditional. - Add a test to
pandas/tests/io/formats/style/test_style.py
that addresses this.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
pandas style - how to hide the column labels? - Stack Overflow
There is a hide_index() method that removes the index row, unfortunately the hide_column() label removes the entire column (both the header and ...
Read more >pandas.io.formats.style.Styler.hide_columns
Hide the column headers or specific keys in the columns from rendering. This method has dual functionality: if subset is None then the...
Read more >Error message when you try to insert or hide rows or columns ...
Explains that you receive a "Cannot shift objects off sheet" error message when you hide columns in Excel. You can change the position...
Read more >DataTables example - Show / hide columns dynamically
Name Position Office Age Start date Salary
Airi Satou Accountant Tokyo 33 2008‑11‑28 $162,700
Angelica Ramos Chief Executive Officer (CEO) London 47 2009‑10‑09 $1,200,000
Ashton Cox...
Read more >Table - IBM
A Color Style other than None must be specified. ... If the table is sorting or filtering, the newly added row might not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@skvrahul @raghuabhishek you both seem to be confused by the name of an index and the values of an index, be it, a row-index or a column-index. The mentioned documentation in the OP should clarify this also, but here is a screenshot of the issue on master:
Yeah this clears things up. Thanks!
Looks like I missed naming the index in my example, which threw me off.