Skip to content

DOC: Add deprecation marks to deprecated functions #48183

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

Merged
merged 3 commits into from
Aug 21, 2022
Merged
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
15 changes: 15 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,12 @@ cdef class _Timedelta(timedelta):

@property
def freq(self) -> None:
"""
Freq property.

.. deprecated:: 1.5.0
This argument is deprecated.
"""
# GH#46430
warnings.warn(
"Timedelta.freq is deprecated and will be removed in a future version",
Expand All @@ -1064,6 +1070,12 @@ cdef class _Timedelta(timedelta):

@property
def is_populated(self) -> bool:
"""
Is_populated property.

.. deprecated:: 1.5.0
This argument is deprecated.
"""
# GH#46430
warnings.warn(
"Timedelta.is_populated is deprecated and will be removed in a future version",
Expand Down Expand Up @@ -1245,6 +1257,9 @@ cdef class _Timedelta(timedelta):
"""
Return the timedelta in nanoseconds (ns), for internal compatibility.

.. deprecated:: 1.5.0
This argument is deprecated.

Returns
-------
int
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,10 @@ 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
Expand Down
30 changes: 29 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,35 @@ def items(self) -> Iterable[tuple[Hashable, Series]]:
for i, k in enumerate(self.columns):
yield k, self._ixs(i, axis=1)

@Appender(_shared_docs["items"])
_shared_docs[
"iteritems"
] = r"""
Iterate over (column name, Series) pairs.

.. deprecated:: 1.5.0
iteritems is deprecated and will be removed in a future version.
Use .items instead.

Iterates over the DataFrame columns, returning a tuple with
the column name and the content as a Series.

Yields
------
label : object
The column names for the DataFrame being iterated over.
content : Series
The column entries belonging to each label, as a Series.

See Also
--------
DataFrame.iter : Recommended alternative.
DataFrame.iterrows : Iterate over DataFrame rows as
(index, Series) pairs.
DataFrame.itertuples : Iterate over DataFrame rows as namedtuples
of the values.
"""

@Appender(_shared_docs["iteritems"])
def iteritems(self) -> Iterable[tuple[Hashable, Series]]:
warnings.warn(
"iteritems is deprecated and will be removed in a future version. "
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,10 @@ def _can_hold_na(self) -> bool:
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. "
Expand Down
23 changes: 22 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,8 +1807,29 @@ def items(self) -> Iterable[tuple[Hashable, Any]]:
"""
return zip(iter(self.index), iter(self))

@Appender(items.__doc__)
def iteritems(self) -> Iterable[tuple[Hashable, Any]]:
"""
Lazily iterate over (index, value) tuples.

.. deprecated:: 1.5.0
iteritems is deprecated and will be removed in a future version.
Use .items instead.

This method returns an iterable tuple (index, value). This is
convenient if you want to create a lazy iterator.

Returns
-------
iterable
Iterable of tuples containing the (index, value) pairs from a
Series.

See Also
--------
Series.items : Recommended alternative.
DataFrame.items : Iterate over (column name, Series) pairs.
DataFrame.iterrows : Iterate over DataFrame rows as (index, Series) pairs.
"""
warnings.warn(
"iteritems is deprecated and will be removed in a future version. "
"Use .items instead.",
Expand Down