|
21 | 21 | lib,
|
22 | 22 | )
|
23 | 23 | from pandas._libs.tslibs import conversion
|
| 24 | +from pandas.errors import Pandas4Warning |
24 | 25 | from pandas.util._exceptions import find_stack_level
|
25 | 26 |
|
26 | 27 | from pandas.core.dtypes.base import _registry as registry
|
@@ -235,7 +236,7 @@ def is_sparse(arr) -> bool:
|
235 | 236 | warnings.warn(
|
236 | 237 | "is_sparse is deprecated and will be removed in a future "
|
237 | 238 | "version. Check `isinstance(dtype, pd.SparseDtype)` instead.",
|
238 |
| - DeprecationWarning, |
| 239 | + Pandas4Warning, |
239 | 240 | stacklevel=2,
|
240 | 241 | )
|
241 | 242 |
|
@@ -370,7 +371,7 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool:
|
370 | 371 | warnings.warn(
|
371 | 372 | "is_datetime64tz_dtype is deprecated and will be removed in a future "
|
372 | 373 | "version. Check `isinstance(dtype, pd.DatetimeTZDtype)` instead.",
|
373 |
| - DeprecationWarning, |
| 374 | + Pandas4Warning, |
374 | 375 | stacklevel=2,
|
375 | 376 | )
|
376 | 377 | if isinstance(arr_or_dtype, DatetimeTZDtype):
|
@@ -466,7 +467,7 @@ def is_period_dtype(arr_or_dtype) -> bool:
|
466 | 467 | warnings.warn(
|
467 | 468 | "is_period_dtype is deprecated and will be removed in a future version. "
|
468 | 469 | "Use `isinstance(dtype, pd.PeriodDtype)` instead",
|
469 |
| - DeprecationWarning, |
| 470 | + Pandas4Warning, |
470 | 471 | stacklevel=2,
|
471 | 472 | )
|
472 | 473 | if isinstance(arr_or_dtype, ExtensionDtype):
|
@@ -524,7 +525,7 @@ def is_interval_dtype(arr_or_dtype) -> bool:
|
524 | 525 | warnings.warn(
|
525 | 526 | "is_interval_dtype is deprecated and will be removed in a future version. "
|
526 | 527 | "Use `isinstance(dtype, pd.IntervalDtype)` instead",
|
527 |
| - DeprecationWarning, |
| 528 | + Pandas4Warning, |
528 | 529 | stacklevel=2,
|
529 | 530 | )
|
530 | 531 | if isinstance(arr_or_dtype, ExtensionDtype):
|
@@ -578,7 +579,7 @@ def is_categorical_dtype(arr_or_dtype) -> bool:
|
578 | 579 | warnings.warn(
|
579 | 580 | "is_categorical_dtype is deprecated and will be removed in a future "
|
580 | 581 | "version. Use isinstance(dtype, pd.CategoricalDtype) instead",
|
581 |
| - DeprecationWarning, |
| 582 | + Pandas4Warning, |
582 | 583 | stacklevel=2,
|
583 | 584 | )
|
584 | 585 | if isinstance(arr_or_dtype, ExtensionDtype):
|
@@ -973,7 +974,7 @@ def is_int64_dtype(arr_or_dtype) -> bool:
|
973 | 974 | warnings.warn(
|
974 | 975 | "is_int64_dtype is deprecated and will be removed in a future "
|
975 | 976 | "version. Use dtype == np.int64 instead.",
|
976 |
| - DeprecationWarning, |
| 977 | + Pandas4Warning, |
977 | 978 | stacklevel=2,
|
978 | 979 | )
|
979 | 980 | return _is_dtype_type(arr_or_dtype, classes(np.int64))
|
@@ -1436,7 +1437,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
|
1436 | 1437 | "The behavior of is_bool_dtype with an object-dtype Index "
|
1437 | 1438 | "of bool objects is deprecated. In a future version, "
|
1438 | 1439 | "this will return False. Cast the Index to a bool dtype instead.",
|
1439 |
| - DeprecationWarning, |
| 1440 | + Pandas4Warning, |
1440 | 1441 | stacklevel=2,
|
1441 | 1442 | )
|
1442 | 1443 | return True
|
|
0 commit comments