Skip to content

Commit b0e3bbf

Browse files
phoflnoatamir
authored andcommitted
DOC: Add deprecation marks to deprecated functions (pandas-dev#48183)
* DOC: Add deprecation marks to deprecated functions * Address docs * docstrings
1 parent 1397fd0 commit b0e3bbf

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

pandas/_libs/tslibs/timedeltas.pyx

+15
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,12 @@ cdef class _Timedelta(timedelta):
10541054

10551055
@property
10561056
def freq(self) -> None:
1057+
"""
1058+
Freq property.
1059+
1060+
.. deprecated:: 1.5.0
1061+
This argument is deprecated.
1062+
"""
10571063
# GH#46430
10581064
warnings.warn(
10591065
"Timedelta.freq is deprecated and will be removed in a future version",
@@ -1064,6 +1070,12 @@ cdef class _Timedelta(timedelta):
10641070

10651071
@property
10661072
def is_populated(self) -> bool:
1073+
"""
1074+
Is_populated property.
1075+
1076+
.. deprecated:: 1.5.0
1077+
This argument is deprecated.
1078+
"""
10671079
# GH#46430
10681080
warnings.warn(
10691081
"Timedelta.is_populated is deprecated and will be removed in a future version",
@@ -1245,6 +1257,9 @@ cdef class _Timedelta(timedelta):
12451257
"""
12461258
Return the timedelta in nanoseconds (ns), for internal compatibility.
12471259
1260+
.. deprecated:: 1.5.0
1261+
This argument is deprecated.
1262+
12481263
Returns
12491264
-------
12501265
int

pandas/core/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,10 @@ def is_monotonic(self) -> bool:
10571057
"""
10581058
Return boolean if values in the object are monotonically increasing.
10591059
1060+
.. deprecated:: 1.5.0
1061+
is_monotonic is deprecated and will be removed in a future version.
1062+
Use is_monotonic_increasing instead.
1063+
10601064
Returns
10611065
-------
10621066
bool

pandas/core/frame.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,35 @@ def items(self) -> Iterable[tuple[Hashable, Series]]:
13241324
for i, k in enumerate(self.columns):
13251325
yield k, self._ixs(i, axis=1)
13261326

1327-
@Appender(_shared_docs["items"])
1327+
_shared_docs[
1328+
"iteritems"
1329+
] = r"""
1330+
Iterate over (column name, Series) pairs.
1331+
1332+
.. deprecated:: 1.5.0
1333+
iteritems is deprecated and will be removed in a future version.
1334+
Use .items instead.
1335+
1336+
Iterates over the DataFrame columns, returning a tuple with
1337+
the column name and the content as a Series.
1338+
1339+
Yields
1340+
------
1341+
label : object
1342+
The column names for the DataFrame being iterated over.
1343+
content : Series
1344+
The column entries belonging to each label, as a Series.
1345+
1346+
See Also
1347+
--------
1348+
DataFrame.iter : Recommended alternative.
1349+
DataFrame.iterrows : Iterate over DataFrame rows as
1350+
(index, Series) pairs.
1351+
DataFrame.itertuples : Iterate over DataFrame rows as namedtuples
1352+
of the values.
1353+
"""
1354+
1355+
@Appender(_shared_docs["iteritems"])
13281356
def iteritems(self) -> Iterable[tuple[Hashable, Series]]:
13291357
warnings.warn(
13301358
"iteritems is deprecated and will be removed in a future version. "

pandas/core/indexes/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,10 @@ def _can_hold_na(self) -> bool:
22852285
def is_monotonic(self) -> bool:
22862286
"""
22872287
Alias for is_monotonic_increasing.
2288+
2289+
.. deprecated:: 1.5.0
2290+
is_monotonic is deprecated and will be removed in a future version.
2291+
Use is_monotonic_increasing instead.
22882292
"""
22892293
warnings.warn(
22902294
"is_monotonic is deprecated and will be removed in a future version. "

pandas/core/series.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -1816,8 +1816,29 @@ def items(self) -> Iterable[tuple[Hashable, Any]]:
18161816
"""
18171817
return zip(iter(self.index), iter(self))
18181818

1819-
@Appender(items.__doc__)
18201819
def iteritems(self) -> Iterable[tuple[Hashable, Any]]:
1820+
"""
1821+
Lazily iterate over (index, value) tuples.
1822+
1823+
.. deprecated:: 1.5.0
1824+
iteritems is deprecated and will be removed in a future version.
1825+
Use .items instead.
1826+
1827+
This method returns an iterable tuple (index, value). This is
1828+
convenient if you want to create a lazy iterator.
1829+
1830+
Returns
1831+
-------
1832+
iterable
1833+
Iterable of tuples containing the (index, value) pairs from a
1834+
Series.
1835+
1836+
See Also
1837+
--------
1838+
Series.items : Recommended alternative.
1839+
DataFrame.items : Iterate over (column name, Series) pairs.
1840+
DataFrame.iterrows : Iterate over DataFrame rows as (index, Series) pairs.
1841+
"""
18211842
warnings.warn(
18221843
"iteritems is deprecated and will be removed in a future version. "
18231844
"Use .items instead.",

0 commit comments

Comments
 (0)