Skip to content

DEPR: remove Index.is_monotonic and Series.is_monotonic #49484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/redirects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ generated/pandas.Index.is_integer,../reference/api/pandas.Index.is_integer
generated/pandas.Index.is_interval,../reference/api/pandas.Index.is_interval
generated/pandas.Index.is_lexsorted_for_tuple,../reference/api/pandas.Index.is_lexsorted_for_tuple
generated/pandas.Index.is_monotonic_decreasing,../reference/api/pandas.Index.is_monotonic_decreasing
generated/pandas.Index.is_monotonic,../reference/api/pandas.Index.is_monotonic
generated/pandas.Index.is_monotonic_increasing,../reference/api/pandas.Index.is_monotonic_increasing
generated/pandas.Index.isna,../reference/api/pandas.Index.isna
generated/pandas.Index.isnull,../reference/api/pandas.Index.isnull
Expand Down Expand Up @@ -1068,7 +1067,6 @@ generated/pandas.Series.interpolate,../reference/api/pandas.Series.interpolate
generated/pandas.Series.is_copy,../reference/api/pandas.Series.is_copy
generated/pandas.Series.isin,../reference/api/pandas.Series.isin
generated/pandas.Series.is_monotonic_decreasing,../reference/api/pandas.Series.is_monotonic_decreasing
generated/pandas.Series.is_monotonic,../reference/api/pandas.Series.is_monotonic
generated/pandas.Series.is_monotonic_increasing,../reference/api/pandas.Series.is_monotonic_increasing
generated/pandas.Series.isna,../reference/api/pandas.Series.isna
generated/pandas.Series.isnull,../reference/api/pandas.Series.isnull
Expand Down
1 change: 0 additions & 1 deletion doc/source/reference/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Properties
:toctree: api/

Index.values
Index.is_monotonic
Index.is_monotonic_increasing
Index.is_monotonic_decreasing
Index.is_unique
Expand Down
1 change: 0 additions & 1 deletion doc/source/reference/series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ Computations / descriptive stats
Series.unique
Series.nunique
Series.is_unique
Series.is_monotonic
Series.is_monotonic_increasing
Series.is_monotonic_decreasing
Series.value_counts
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ Removal of prior version deprecations/changes
- Removed :func:`is_extension_type` in favor of :func:`is_extension_array_dtype` (:issue:`29457`)
- Removed ``.ExponentialMovingWindow.vol`` (:issue:`39220`)
- Removed :meth:`Index.get_value` and :meth:`Index.set_value` (:issue:`33907`, :issue:`28621`)
- Removed :meth:`Series.is_monotonic` and :meth:`Index.is_monotonic` in favor of :meth:`Series.is_monotonic_increasing` and :meth:`Index.is_monotonic_increasing` (:issue:`45422`)
- Removed :meth:`Series.slice_shift` and :meth:`DataFrame.slice_shift` (:issue:`37601`)
- Remove :meth:`DataFrameGroupBy.pad` and :meth:`DataFrameGroupBy.backfill` (:issue:`45076`)
- Remove ``numpy`` argument from :func:`read_json` (:issue:`30636`)
Expand Down
23 changes: 0 additions & 23 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
final,
overload,
)
import warnings

import numpy as np

Expand All @@ -38,7 +37,6 @@
cache_readonly,
doc,
)
from pandas.util._exceptions import find_stack_level

from pandas.core.dtypes.common import (
is_categorical_dtype,
Expand Down Expand Up @@ -1062,27 +1060,6 @@ def is_unique(self) -> bool:
"""
return self.nunique(dropna=False) == len(self)

@property
def is_monotonic(self) -> bool:
"""
Return boolean if values in the object are monotonically increasing.

.. deprecated:: 1.5.0
is_monotonic is deprecated and will be removed in a future version.
Use is_monotonic_increasing instead.

Returns
-------
bool
"""
warnings.warn(
"is_monotonic is deprecated and will be removed in a future version. "
"Use is_monotonic_increasing instead.",
FutureWarning,
stacklevel=find_stack_level(),
)
return self.is_monotonic_increasing

@property
def is_monotonic_increasing(self) -> bool:
"""
Expand Down
18 changes: 0 additions & 18 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,24 +2197,6 @@ def _can_hold_na(self) -> bool:
return False
return True

@final
@property
def is_monotonic(self) -> bool:
"""
Alias for is_monotonic_increasing.

.. deprecated:: 1.5.0
is_monotonic is deprecated and will be removed in a future version.
Use is_monotonic_increasing instead.
"""
warnings.warn(
"is_monotonic is deprecated and will be removed in a future version. "
"Use is_monotonic_increasing instead.",
FutureWarning,
stacklevel=find_stack_level(),
)
return self.is_monotonic_increasing

@property
def is_monotonic_increasing(self) -> bool:
"""
Expand Down