10000 BUG/ENH: `Styler.format()` always inherits from `.set_na_rep()` by attack68 · Pull Request #40060 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG/ENH: Styler.format() always inherits from .set_na_rep() #40060

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

Closed
wants to merge 15 commits into from
Prev Previous commit
Next Next commit
mypy
  • Loading branch information
attack68 committed Feb 25, 2021
commit 0d675624a208bddcede783f2d9b2b9c4bf79852e
8 changes: 4 additions & 4 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ def _maybe_wrap_formatter(
Allows formatters to be expressed as str, callable or None, where None returns
a default formatting function. wraps with na_rep where it is available.
"""
if formatter is None:
func = self._default_formatter
elif isinstance(formatter, str):
func = lambda x: formatter.format(x) # type: ignore # mypy issue 10136
if isinstance(formatter, str):
func = lambda x: formatter.format(x)
elif callable(formatter):
func = formatter
elif formatter is None:
func = self._default_formatter
else:
raise TypeError(
f"'formatter' expected str or callable, got {type(formatter)}"
Expand Down
0