Cannot Interpret CategoricalDtype

Sorry to ask this without reproducible code but I’m having issues finding a solution for my problem.

I copied over a notebook I have been using for quite a while on some secret squirrel project (another reason I am asking a question without providing almost any code).

The short of it is that with no changes besides installing new fastai packages, I’m getting the error when I attempt to run my cont_cat_split as I always have, except now it is giving me a typeerror

cont_nn,cat_nn = cont_cat_split(train, max_card = 50, dep_var=dep_var)


TypeError Traceback (most recent call last)
in
1 #This will show us which variables are continuous vs. categorical variables based on Maximum Cardinality (levels)
----> 2 cont_nn,cat_nn = cont_cat_split(train, max_card = 50, dep_var=dep_var)
3 #cat_nn

~\anaconda3\envs\Qnetworks\lib\site-packages\fastai\tabular\core.py in cont_cat_split(df, max_card, dep_var)
86 for label in df:
87 if label in L(dep_var): continue
—> 88 if df[label].dtype == int and df[label].unique().shape[0] > max_card or df[label].dtype == float:
89 cont_names.append(label)
90 else: cat_names.append(label)

~\anaconda3\envs\Qnetworks\lib\site-packages\numpy\core\numerictypes.py in issubdtype(arg1, arg2)
386 “”"
387 if not issubclass_(arg1, generic):
–> 388 arg1 = dtype(arg1).type
389 if not issubclass_(arg2, generic):
390 arg2 = dtype(arg2).type

TypeError: Cannot interpret ‘CategoricalDtype(categories=[‘Cat1’,‘Cat2’,‘Cat3’]
, ordered=False)’ as a data type

I then removed that category and it spit out the same error on the next category.
I created some fake data to attempt to reproduce this, but it ran through the data just fine without issue. Nothing about my data has changed since I last ran this.

The only changes are some extra libraries in this anaconda environment and I was running on Linux, and now I’m on Windows. However, I imported the same libraries to see if I could reproduce this in a new notebook, and I was not able to reproduce the error.

Any thoughts on why this is happening?

Have a look here: Problem with cont_cat_split() in Google Collab

You might want to check if replacing cont_cat_split with the modified version helps.

The issue should be fixe in 2.2.5.

Be aware, that there apparently is a problem with this release on PyPI: https://github.com/fastai/fastai/issues/3220