Skip to content

Commit 5bbd589

Browse files
quant12345fabclmnt
authored andcommitted
fix: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, pd.CategoricalDtype)
1 parent 227b917 commit 5bbd589

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/ydata_profiling/model/typeset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def get_relations() -> Sequence[TypeRelation]:
122122
@series_handle_nulls
123123
def contains_op(series: pd.Series, state: dict) -> bool:
124124
return (
125-
not pdt.is_categorical_dtype(series)
125+
not isinstance(series.dtype, pd.CategoricalDtype)
126126
and pdt.is_string_dtype(series)
127127
and series_is_string(series, state)
128128
)
@@ -205,9 +205,9 @@ def get_relations() -> Sequence[TypeRelation]:
205205
@series_not_empty
206206
@series_handle_nulls
207207
def contains_op(series: pd.Series, state: dict) -> bool:
208-
is_valid_dtype = pdt.is_categorical_dtype(series) and not pdt.is_bool_dtype(
209-
series
210-
)
208+
is_valid_dtype = isinstance(
209+
series.dtype, pd.CategoricalDtype
210+
) and not pdt.is_bool_dtype(series)
211211
if is_valid_dtype:
212212
return True
213213
return False

src/ydata_profiling/model/typeset_relations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def string_is_bool(series: pd.Series, state: dict, k: Dict[str, bool]) -> bool:
3131
def tester(s: pd.Series, state: dict) -> bool:
3232
return s.str.lower().isin(k.keys()).all()
3333

34-
if pdt.is_categorical_dtype(series):
34+
if isinstance(series.dtype, pd.CategoricalDtype):
3535
return False
3636

3737
return tester(series, state)

0 commit comments

Comments
 (0)