-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
ENH: Add ability to style axis names with Styler #48972
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
Conversation
| else self.css["blank_value"], | ||
| not all(self.hide_index_), | ||
| ) | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
column_name = [ _element( "th", ( f"{self.css['blank']} {self.css['level']}{r}" if name is None else f"{self.css['columns_name']} {self.css['level']}{r}" ), name if (name is not None and not self.hide_column_names) else self.css["blank_value"], not all(self.hide_index_), ) ]Is this a breaking change? For column level names, it removes the index_name class and adds in the columns_names class in it's place. If users were purposefully doing styles with .index_name selectors with the intention of applying those to column level names, it will break that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it will break the example in the user guide because that styles class index_name.
However, this should be an easy fix:
index_names = { 'selector': '.index_name, .col_name', 'props': 'font-style: italic; color: darkgrey; font-weight:normal;' } As long as this break is documented I think including the additional functionality is worth it in long run.
pandas/io/formats/style.py Outdated
| css_class_names = {"row_heading": "row_heading", | ||
| "col_heading": "col_heading", | ||
| "index_name": "index_name", | ||
| "columns_name": "columns_name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "columns_name": "columns_name", | |
| "col_name": "col_name", |
pandas/io/formats/style_render.py Outdated
| "row_heading": "row_heading", | ||
| "col_heading": "col_heading", | ||
| "index_name": "index_name", | ||
| "columns_name": "columns_name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "columns_name": "columns_name", | |
| "col_name": "col_name", |
| not all(self.hide_index_) | ||
| and (r, 0) in self.ctx_columns_names | ||
| and self.ctx_columns_names[r, 0] | ||
| ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this following the same pattern as above?
| I think this PR looks good but there are a few things to check off:
should suffice.
|
| This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Still working on this |
| Note to self on current progress:
|
| Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.cc: @attack68