-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
ENH: Add built-in function for Styler to format the text displayed for missing values #29118
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
Changes from 2 commits
c42de40
01632ce
53b0843
7a5dd65
da3cb43
bdfff98
b86bdc6
a1e9a9e
def71c9
af396b1
3d4cfd0
bd99db9
346eee6
7935359
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -930,6 +930,25 @@ def hide_columns(self, subset): | |
| # A collection of "builtin" styles | ||
| # ----------------------------------------------------------------------- | ||
|
|
||
| def format_null(self, na_rep="-"): | ||
| """ | ||
| Format the text displayed for missing values. | ||
|
|
||
| .. versionadded:: 1.0.0 | ||
|
|
||
| Parameters | ||
| ---------- | ||
| na_rep : str | ||
|
|
||
| Returns | ||
| ------- | ||
| self : Styler | ||
| """ | ||
| self.format( | ||
|
||
| lambda x: na_rep if pd.isna(x) else self._display_funcs.default_factory()(x) | ||
| ) | ||
| return self | ||
|
|
||
| @staticmethod | ||
| def _highlight_null(v, null_color): | ||
| return ( | ||
|
|
||
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.
can u add this into the user guide as well
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.
I'd like the name
format_nansbetter, to be similar tofillna,hasnansetc.@jreback?
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.
Sure, I'll be glad to!