Skip to content

Commit

Permalink
pandas compat: address is_categorical_dtype deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed May 4, 2023
1 parent 971f47e commit 78e9477
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion seaborn/_core/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def variable_type(
"""

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

# Special-case all-na data, which is always "numeric"
Expand Down
2 changes: 1 addition & 1 deletion seaborn/_oldcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ def variable_type(vector, boolean_type="numeric"):
"""

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

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

0 comments on commit 78e9477

Please sign in to comment.