Skip to content

Commit

Permalink
Merge pull request #6638 from markotoplak/pandas-dep
Browse files Browse the repository at this point in the history
Replace use of the deprecated pandas.api.types.is_categorical_dtype
  • Loading branch information
PrimozGodec committed Nov 20, 2023
2 parents 0957652 + ffa205d commit d9ce49d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Orange/widgets/data/owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import numpy as np
import pandas.errors
import pandas as pd
from pandas import CategoricalDtype
from pandas.api import types as pdtypes

from orangewidget.utils import enum_as_int
Expand Down Expand Up @@ -1770,7 +1771,7 @@ def pandas_to_table(df):
columns = [] # type: List[Tuple[Orange.data.Variable, np.ndarray]]

for header, series in df.items(): # type: (Any, pd.Series)
if pdtypes.is_categorical_dtype(series):
if isinstance(series.dtype, CategoricalDtype):
coldata = series.values # type: pd.Categorical
categories = natural_sorted(str(c) for c in coldata.categories)
var = Orange.data.DiscreteVariable.make(
Expand Down

0 comments on commit d9ce49d

Please sign in to comment.