Skip to content

Commit 05ce6dc

Browse files
Backport PR #48599 on branch 1.5.x (DOC: Add deprecation infos to deprecated functions) (#48690)
Backport PR #48599: DOC: Add deprecation infos to deprecated functions Co-authored-by: Patrick Hoefler <[email protected]>
1 parent e707814 commit 05ce6dc

File tree

4 files changed

+69
-8
lines changed

4 files changed

+69
-8
lines changed

pandas/core/groupby/groupby.py

+32-4
Original file line numberDiff line numberDiff line change
@@ -2948,6 +2948,22 @@ def ffill(self, limit=None):
29482948
return self._fill("ffill", limit=limit)
29492949

29502950
def pad(self, limit=None):
2951+
"""
2952+
Forward fill the values.
2953+
2954+
.. deprecated:: 1.4
2955+
Use ffill instead.
2956+
2957+
Parameters
2958+
----------
2959+
limit : int, optional
2960+
Limit of how many values to fill.
2961+
2962+
Returns
2963+
-------
2964+
Series or DataFrame
2965+
Object with missing values filled.
2966+
"""
29512967
warnings.warn(
29522968
"pad is deprecated and will be removed in a future version. "
29532969
"Use ffill instead.",
@@ -2956,8 +2972,6 @@ def pad(self, limit=None):
29562972
)
29572973
return self.ffill(limit=limit)
29582974

2959-
pad.__doc__ = ffill.__doc__
2960-
29612975
@final
29622976
@Substitution(name="groupby")
29632977
def bfill(self, limit=None):
@@ -2984,6 +2998,22 @@ def bfill(self, limit=None):
29842998
return self._fill("bfill", limit=limit)
29852999

29863000
def backfill(self, limit=None):
3001+
"""
3002+
Backward fill the values.
3003+
3004+
.. deprecated:: 1.4
3005+
Use bfill instead.
3006+
3007+
Parameters
3008+
----------
3009+
limit : int, optional
3010+
Limit of how many values to fill.
3011+
3012+
Returns
3013+
-------
3014+
Series or DataFrame
3015+
Object with missing values filled.
3016+
"""
29873017
warnings.warn(
29883018
"backfill is deprecated and will be removed in a future version. "
29893019
"Use bfill instead.",
@@ -2992,8 +3022,6 @@ def backfill(self, limit=None):
29923022
)
29933023
return self.bfill(limit=limit)
29943024

2995-
backfill.__doc__ = bfill.__doc__
2996-
29973025
@final
29983026
@Substitution(name="groupby")
29993027
@Substitution(see_also=_common_see_also)

pandas/core/indexes/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -3766,6 +3766,10 @@ def get_loc(self, key, method=None, tolerance=None):
37663766
* backfill / bfill: use NEXT index value if no exact match
37673767
* nearest: use the NEAREST index value if no exact match. Tied
37683768
distances are broken by preferring the larger index value.
3769+
3770+
.. deprecated:: 1.4
3771+
Use index.get_indexer([item], method=...) instead.
3772+
37693773
tolerance : int or float, optional
37703774
Maximum distance from index value for inexact matches. The value of
37713775
the index at the matching location must satisfy the equation

pandas/core/indexes/interval.py

+2
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ def get_loc(
592592
method : {None}, optional
593593
* default: matches where the label is within an interval only.
594594
595+
.. deprecated:: 1.4
596+
595597
Returns
596598
-------
597599
int if unique index, slice if monotonic index, else mask

pandas/core/resample.py

+31-4
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,21 @@ def ffill(self, limit=None):
546546
return self._upsample("ffill", limit=limit)
547547

548548
def pad(self, limit=None):
549+
"""
550+
Forward fill the values.
551+
552+
.. deprecated:: 1.4
553+
Use ffill instead.
554+
555+
Parameters
556+
----------
557+
limit : int, optional
558+
Limit of how many values to fill.
559+
560+
Returns
561+
-------
562+
An upsampled Series.
563+
"""
549564
warnings.warn(
550565
"pad is deprecated and will be removed in a future version. "
551566
"Use ffill instead.",
@@ -554,8 +569,6 @@ def pad(self, limit=None):
554569
)
555570
return self.ffill(limit=limit)
556571

557-
pad.__doc__ = ffill.__doc__
558-
559572
def nearest(self, limit=None):
560573
"""
561574
Resample by using the nearest value.
@@ -719,6 +732,22 @@ def bfill(self, limit=None):
719732
return self._upsample("bfill", limit=limit)
720733

721734
def backfill(self, limit=None):
735+
"""
736+
Backward fill the values.
737+
738+
.. deprecated:: 1.4
739+
Use bfill instead.
740+
741+
Parameters
742+
----------
743+
limit : int, optional
744+
Limit of how many values to fill.
745+
746+
Returns
747+
-------
748+
Series, DataFrame
749+
An upsampled Series or DataFrame with backward filled NaN values.
750+
"""
722751
warnings.warn(
723752
"backfill is deprecated and will be removed in a future version. "
724753
"Use bfill instead.",
@@ -727,8 +756,6 @@ def backfill(self, limit=None):
727756
)
728757
return self.bfill(limit=limit)
729758

730-
backfill.__doc__ = bfill.__doc__
731-
732759
def fillna(self, method, limit=None):
733760
"""
734761
Fill missing values introduced by upsampling.

0 commit comments

Comments
 (0)