Skip to content

Commit

Permalink
Revert "is type refactor (#46119)"
Browse files Browse the repository at this point in the history
This reverts commit 541bbf9.
  • Loading branch information
simonjayhawkins committed Mar 25, 2022
1 parent f99ec8b commit 066da75
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pandas/io/formats/style_render.py
Expand Up @@ -25,11 +25,6 @@
from pandas._typing import Level
from pandas.compat._optional import import_optional_dependency

from pandas.core.dtypes.common import (
is_complex,
is_float,
is_integer,
)
from pandas.core.dtypes.generic import ABCSeries

from pandas import (
Expand Down Expand Up @@ -1532,9 +1527,9 @@ def _default_formatter(x: Any, precision: int, thousands: bool = False) -> Any:
value : Any
Matches input type, or string if input is float or complex or int with sep.
"""
if is_float(x) or is_complex(x):
if isinstance(x, (float, complex)):
return f"{x:,.{precision}f}" if thousands else f"{x:.{precision}f}"
elif is_integer(x):
elif isinstance(x, int):
return f"{x:,.0f}" if thousands else f"{x:.0f}"
return x

Expand All @@ -1549,7 +1544,7 @@ def _wrap_decimal_thousands(
"""

def wrapper(x):
if is_float(x) or is_integer(x) or is_complex(x):
if isinstance(x, (float, complex, int)):
if decimal != "." and thousands is not None and thousands != ",":
return (
formatter(x)
Expand Down

0 comments on commit 066da75

Please sign in to comment.