Skip to content

Commit

Permalink
Replace use of the deprecated pandas.api.types.is_categorical_dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Nov 17, 2023
1 parent 0957652 commit ffa205d
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 ffa205d

Please sign in to comment.