File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 4747 if hasattr (pandas , "api" ):
4848 # This is available starting in pandas v0.19.0
4949 have_pandas_categorical_dtype = True
50- _pandas_is_categorical_dtype = pandas .api .types .is_categorical_dtype
50+ _pandas_is_categorical_dtype = getattr (pandas .api .types , "is_categorical_dtype" , None )
51+ # pandas.api.types._pandas_is_categorical_dtype is deprecated in pandas v2.1.0
52+ if _pandas_is_categorical_dtype is not None :
53+ import warnings
54+ with warnings .catch_warnings (record = True ) as w :
55+ _pandas_is_categorical_dtype (int )
56+ if len (w ) > 0 and issubclass (w [- 1 ].category , FutureWarning ):
57+ _pandas_is_categorical_dtype = None
58+ else :
59+ _pandas_is_categorical_dtype = lambda x : isinstance (x , pandas .CategoricalDType )
5160 else :
5261 # This is needed for pandas v0.18.0 and earlier
5362 _pandas_is_categorical_dtype = getattr (pandas .core .common ,
You can’t perform that action at this time.
0 commit comments