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.

using DataFrame.style loses all default table styling

See original GitHub issue

Bug report for Colab: http://colab.research.google.com/.

For questions about colab usage, please use stackoverflow.

  • Describe the current behavior:

Using the DataFrame.style in anyway completely removes all default table styling for dataframes.

See also this stackoverflow question

  • Describe the expected behavior:

Using dataframe.style.apply and/or dataframe.style.applymap should add to the existing style, not remove all existing style. This is the default behavior in Jupyter.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bloiscommented, Sep 10, 2021

Colab only applies the ‘dataframe’ styling to HTML table elements with the dataframe classname. The regular dataframe adds the dataframe class but the styler one does not.

The best approach is probably to explicitly add the dataframe class:

df.style.highlight_max().set_table_attributes('class="dataframe"')

This may possibly be addressed as part of https://github.com/pandas-dev/pandas/issues/41693?

0reactions
craigcitrocommented, Oct 31, 2021

Indeed, this is now fixed, and we forgot to close this issue. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas Styles removing default table format - Stack Overflow
Basically, all I want is to get the "Thousand" separator on my values. I managed to do it using the pd.style.format function. It...
Read more >
Table Visualization — pandas 1.5.2 documentation - PyData |
The Styler creates an HTML <table> and leverages CSS styling language to manipulate many parameters including colors, fonts, borders, background, etc. See here ......
Read more >
Style Pandas Dataframe Like a Master - Towards Data Science
The basic idea behind styling is to leverage visual aids like color and format, in order to communicate insight more efficiently.
Read more >
Style Python Pandas DataFrames! (Conditional Formatting ...
Learn how to add style to your Pandas DataFrames, including formatting cells, conditional formatting in color, and applying bars to cells.
Read more >
Rendering tables with pandoc.table
Users are advised to stick with the default multiline style, ... simple tables are have more compact syntax that all other styles, ...
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