Skip to content

Commit a48601d

Browse files
authored
pandas compat: address is_categorical_dtype deprecation (#3355)
Co-authored-by: MarcoGorelli <>
1 parent 971f47e commit a48601d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

seaborn/_core/rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def variable_type(
6767
"""
6868

6969
# If a categorical dtype is set, infer categorical
70-
if pd.api.types.is_categorical_dtype(vector):
70+
if isinstance(getattr(vector, 'dtype', None), pd.CategoricalDtype):
7171
return VarType("categorical")
7272

7373
# Special-case all-na data, which is always "numeric"

seaborn/_oldcore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ def variable_type(vector, boolean_type="numeric"):
14971497
"""
14981498

14991499
# If a categorical dtype is set, infer categorical
1500-
if pd.api.types.is_categorical_dtype(vector):
1500+
if isinstance(getattr(vector, 'dtype', None), pd.CategoricalDtype):
15011501
return VariableType("categorical")
15021502

15031503
# Special-case all-na data, which is always "numeric"

0 commit comments

Comments
 (0)