question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: `Styler.hide_columns()` does not hide index name row

See original GitHub issue

Whilst 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:

  1. Find pandas/io/formats/style_render.py
  2. Find the method for the StyleRenderer called _translate_header and read the documentation what it is trying to structure.
  3. Go to the section in the method labelled # 2 and insert self.hide_columns_ into the conditional.
  4. Add a test to pandas/tests/io/formats/style/test_style.py that addresses this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
attack68commented, Jun 22, 2021

@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:

Screen Shot 2021-06-22 at 07 25 34

0reactions
skvrahulcommented, Jun 22, 2021

Yeah this clears things up. Thanks!

Looks like I missed naming the index in my example, which threw me off.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found