Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the column labels after using .style

How do I hide the column labels via pandas style? There is a hide_index() method that removes the index row, unfortunately the hide_column() label removes the entire column (both the header and the data). I just want to hide the headers. thanks!

like image 592
vgoklani Avatar asked Oct 16 '25 17:10

vgoklani


1 Answers

set_table_styles

You can set the style for the table. Docs

Setup

df = pd.DataFrame(1, range(3), ['Look', 'At', 'My', 'Header'])

df.style

enter image description here

df.style.set_table_styles([
    {'selector': 'thead', 'props': [('display', 'none')]}
])

enter image description here

like image 63
piRSquared Avatar answered Oct 18 '25 07:10

piRSquared