@@ -276,9 +276,6 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi
276276 provided).
277277 dtype : CategoricalDtype
278278 An instance of ``CategoricalDtype`` to use for this categorical.
279- fastpath : bool
280- The 'fastpath' keyword in Categorical is deprecated and will be
281- removed in a future version. Use Categorical.from_codes instead.
282279 copy : bool, default True
283280 Whether to copy if the codes are unchanged.
284281
@@ -391,33 +388,15 @@ def __init__(
391388 categories = None ,
392389 ordered = None ,
393390 dtype : Dtype | None = None ,
394- fastpath : bool | lib .NoDefault = lib .no_default ,
395391 copy : bool = True ,
396392 ) -> None :
397- if fastpath is not lib .no_default :
398- # GH#20110
399- warnings .warn (
400- "The 'fastpath' keyword in Categorical is deprecated and will "
401- "be removed in a future version. Use Categorical.from_codes instead" ,
402- DeprecationWarning ,
403- stacklevel = find_stack_level (),
404- )
405- else :
406- fastpath = False
407-
408393 dtype = CategoricalDtype ._from_values_or_dtype (
409394 values , categories , ordered , dtype
410395 )
411396 # At this point, dtype is always a CategoricalDtype, but
412397 # we may have dtype.categories be None, and we need to
413398 # infer categories in a factorization step further below
414399
415- if fastpath :
416- codes = coerce_indexer_dtype (values , dtype .categories )
417- dtype = CategoricalDtype (ordered = False ).update_dtype (dtype )
418- super ().__init__ (codes , dtype )
419- return
420-
421400 if not is_list_like (values ):
422401 # GH#38433
423402 raise TypeError ("Categorical input must be list-like" )
0 commit comments