-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add class=„pandas-empty“ to NaN-cells’ HTML #7338
Conversation
This allows to do CSS styling, e.g. using td.pandas-empty { color: #eee } to de-emphasize, or td.pandas-empty { background-color: yellow } to let empty cells stand out.
I should mention that I do see a weakness in the condition (testing the formatted contents against self.fmt.na_rep). However, currently the design seems to make it very hard to do better; I tried implementing this before and failed, and found this simple "solution" in the above-mentioned PR #5330. |
@hmeine I see what you want to do here. I think we are looking for a more general soln (w/o too much refactoring / and no API breaking).Their are some ideas/suggestions in those linked threads. Just need someone to try an implementation. |
I see, but I would say those are complementary goals. Marking empty cells (and index/column headers, cf. #6488) would be totally non-invasive and scratch obvious itches. The more general solution would be far more capable, but the above allows today to add CSS styling e.g. in IPython notebooks (which I am using daily). |
@y-p created an excellent base from which to start, in #5763 check out this notebook (from that PR): http://nbviewer.ipython.org/github/pydata/pandas/blob/8c4f9571c08d5122f1d9e40c43dadab8b6f10bf5/pandas_HTML_styling.ipynb in #3190 you can see all the linked issues and how many times people have requested little additions or wished pandas did some formatting thing slightly different. i totally get where you're coming from, but i think that most of the legwork was done by @y-p and we should take advantage of it rather than going for the needs of "today". if we make this change we have to support it for the foreseeable future. personally, i'd rather support an addition that is more general. |
👍 on using the soln @cpcloud just pointed, its way more general, not that hard, and almost done. IIRC just needs some tests. Would be willing to put this in once integrated on an experimental basis. Maybe under |
yep my bad thx for correcting |
was gh autocomplete + enter :/ |
This PR is related to #5330, but is much simpler. There is no new API, this just allows styling empty cells using CSS, e.g. using
to de-emphasize, or
to let empty cells stand out.