Skip to content

Commit a625520

Browse files
type check fix
1 parent 8b26a7d commit a625520

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/methods/corr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import numpy as np
1010

11+
from pandas.core.dtypes.dtypes import CategoricalDtype
12+
1113
if TYPE_CHECKING:
1214
from pandas import DataFrame
1315

@@ -21,7 +23,7 @@ def transform_ord_cat_cols_to_coded_cols(df: DataFrame) -> DataFrame:
2123
result = df
2224
made_copy = False
2325
for idx, dtype in enumerate(df.dtypes):
24-
if not dtype == "category" or not dtype.ordered: # type: ignore[attr-defined]
26+
if not isinstance(dtype, CategoricalDtype) or not dtype.ordered:
2527
continue
2628
col = result._ixs(idx, axis=1)
2729
if not made_copy:

0 commit comments

Comments
 (0)