|
7 | 7 | Any,
|
8 | 8 | Callable,
|
9 | 9 | )
|
10 |
| -import warnings |
11 | 10 |
|
12 | 11 | import numpy as np
|
13 | 12 |
|
|
22 | 21 | ArrayLike,
|
23 | 22 | DtypeObj,
|
24 | 23 | )
|
25 |
| -from pandas.util._exceptions import find_stack_level |
26 | 24 |
|
27 | 25 | from pandas.core.dtypes.base import _registry as registry
|
28 | 26 | from pandas.core.dtypes.dtypes import (
|
|
32 | 30 | IntervalDtype,
|
33 | 31 | PeriodDtype,
|
34 | 32 | )
|
35 |
| -from pandas.core.dtypes.generic import ( |
36 |
| - ABCCategorical, |
37 |
| - ABCIndex, |
38 |
| -) |
| 33 | +from pandas.core.dtypes.generic import ABCIndex |
39 | 34 | from pandas.core.dtypes.inference import (
|
40 | 35 | is_array_like,
|
41 | 36 | is_bool,
|
@@ -275,47 +270,6 @@ def is_scipy_sparse(arr) -> bool:
|
275 | 270 | return _is_scipy_sparse(arr)
|
276 | 271 |
|
277 | 272 |
|
278 |
| -def is_categorical(arr) -> bool: |
279 |
| - """ |
280 |
| - Check whether an array-like is a Categorical instance. |
281 |
| -
|
282 |
| - .. deprecated:: 1.1.0 |
283 |
| - Use ``is_categorical_dtype`` instead. |
284 |
| -
|
285 |
| - Parameters |
286 |
| - ---------- |
287 |
| - arr : array-like |
288 |
| - The array-like to check. |
289 |
| -
|
290 |
| - Returns |
291 |
| - ------- |
292 |
| - boolean |
293 |
| - Whether or not the array-like is of a Categorical instance. |
294 |
| -
|
295 |
| - Examples |
296 |
| - -------- |
297 |
| - >>> is_categorical([1, 2, 3]) |
298 |
| - False |
299 |
| -
|
300 |
| - Categoricals, Series Categoricals, and CategoricalIndex will return True. |
301 |
| -
|
302 |
| - >>> cat = pd.Categorical([1, 2, 3]) |
303 |
| - >>> is_categorical(cat) |
304 |
| - True |
305 |
| - >>> is_categorical(pd.Series(cat)) |
306 |
| - True |
307 |
| - >>> is_categorical(pd.CategoricalIndex([1, 2, 3])) |
308 |
| - True |
309 |
| - """ |
310 |
| - warnings.warn( |
311 |
| - "is_categorical is deprecated and will be removed in a future version. " |
312 |
| - "Use is_categorical_dtype instead.", |
313 |
| - FutureWarning, |
314 |
| - stacklevel=find_stack_level(), |
315 |
| - ) |
316 |
| - return isinstance(arr, ABCCategorical) or is_categorical_dtype(arr) |
317 |
| - |
318 |
| - |
319 | 273 | def is_datetime64_dtype(arr_or_dtype) -> bool:
|
320 | 274 | """
|
321 | 275 | Check whether an array-like or dtype is of the datetime64 dtype.
|
@@ -1772,7 +1726,6 @@ def is_all_strings(value: ArrayLike) -> bool:
|
1772 | 1726 | "is_array_like",
|
1773 | 1727 | "is_bool",
|
1774 | 1728 | "is_bool_dtype",
|
1775 |
| - "is_categorical", |
1776 | 1729 | "is_categorical_dtype",
|
1777 | 1730 | "is_complex",
|
1778 | 1731 | "is_complex_dtype",
|
|
0 commit comments