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.

ENH Add CSS for pandas dataframe

See original GitHub issue

With #541, Sphinx-Gallery can capture raw HTML (using the _repr_html_() of an object) and embed in rst. In some cases, where the captured raw HTML does not include CSS (e.g. pandas dataframes), this can be added to make the output look better. For reference this (scroll down) is what a pandas dataframe looks like with just the raw HTML.

For example, Jupyter notebook seems to take CSS from their own renderedhtml.less (see @larsoner’s post). For reference this SO question describes how to get pandas dataframes to look like those in Jupyter notebook.

One solution is that we can include our own CSS for common objects like pandas dataframes (I think this might be beyond the scope of SG).

~Another solution is to obtain CSS from the objects we capture _repr_html_ from, if possible.~

Another solution would be to add a add_css configuration to allow the user add their own CSS file (e.g. pandas dataframes have specific HTML tags that can be used to write CSS specifically for dataframes), a reference to which would be added at the end of raw HTML embedded.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
lucyleeowcommented, Oct 9, 2019

@jorisvandenbossche I agree with you - I don’t think it is up to pandas to provide this. You have already added Styling which is pretty cool.

For me this issue is about whether we should add a CSS config to allow users to provide their own (for objects that don’t have CSS) - I don’t think SG or pandas should provide CSS.

0reactions
lucyleeowcommented, Jan 9, 2020

I’ve amended the issue title to just be about pandas dataframes.

If anyone wishes to add CSS for other elements, another issue can be opened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apply CSS class to Pandas DataFrame using to_html
Pandas ' to_html simply outputs a large string containing HTML table markup. The classes argument is a convenience handler to give the ...
Read more >
Table Visualization — pandas 1.5.2 documentation - PyData |
Table Visualization#. This section demonstrates visualization of tabular data using the Styler class. For information on visualization with charting please ...
Read more >
Progressive Enhancement - GeeksforGeeks
Progressive enhancement is the concept of a web design that ensures that the content of the web application arrives at all users first,...
Read more >
PEP 8 – Style Guide for Python Code
Correct: # Aligned with opening delimiter. foo = long_function_name(var_one, var_two, var_three, var_four) # Add 4 spaces (an extra level of ...
Read more >
Apply CSS class to Pandas DataFrame using to_html - YouTube
Pandas : Apply CSS class to Pandas DataFrame using to_html [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Pandas ...
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