Skip to content
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

DOC: Add deprecation infos to deprecated functions #48599

Merged
merged 4 commits into from
Sep 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
36 changes: 32 additions & 4 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,22 @@ def ffill(self, limit=None):
return self._fill("ffill", limit=limit)

def pad(self, limit=None):
"""
Forward fill the values.

.. deprecated:: 1.4
Use ffill instead.

Parameters
----------
limit : int, optional
Limit of how many values to fill.

Returns
-------
Series or DataFrame
Object with missing values filled.
"""
warnings.warn(
"pad is deprecated and will be removed in a future version. "
"Use ffill instead.",
Expand All @@ -2946,8 +2962,6 @@ def pad(self, limit=None):
)
return self.ffill(limit=limit)

pad.__doc__ = ffill.__doc__

@final
@Substitution(name="groupby")
def bfill(self, limit=None):
Expand All @@ -2974,6 +2988,22 @@ def bfill(self, limit=None):
return self._fill("bfill", limit=limit)

def backfill(self, limit=None):
"""
Backward fill the values.

.. deprecated:: 1.4
Use bfill instead.

Parameters
----------
limit : int, optional
Limit of how many values to fill.

Returns
-------
Series or DataFrame
Object with missing values filled.
"""
warnings.warn(
"backfill is deprecated and will be removed in a future version. "
"Use bfill instead.",
Expand All @@ -2982,8 +3012,6 @@ def backfill(self, limit=None):
)
return self.bfill(limit=limit)

backfill.__doc__ = bfill.__doc__

@final
@Substitution(name="groupby")
@Substitution(see_also=_common_see_also)
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 @@ -3773,6 +3773,10 @@ def get_loc(self, key, method=None, tolerance=None):
* backfill / bfill: use NEXT index value if no exact match
* nearest: use the NEAREST index value if no exact match. Tied
distances are broken by preferring the larger index value.

.. deprecated:: 1.4
Use index.get_indexer([item], method=...) instead.

tolerance : int or float, optional
Maximum distance from index value for inexact matches. The value of
the index at the matching location must satisfy the equation
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ def get_loc(
method : {None}, optional
* default: matches where the label is within an interval only.

.. deprecated:: 1.4

Returns
-------
int if unique index, slice if monotonic index, else mask
Expand Down
35 changes: 31 additions & 4 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,21 @@ def ffill(self, limit=None):
return self._upsample("ffill", limit=limit)

def pad(self, limit=None):
"""
Forward fill the values.

.. deprecated:: 1.4
Use ffill instead.

Parameters
----------
limit : int, optional
Limit of how many values to fill.

Returns
-------
An upsampled Series.
"""
warnings.warn(
"pad is deprecated and will be removed in a future version. "
"Use ffill instead.",
Expand All @@ -554,8 +569,6 @@ def pad(self, limit=None):
)
return self.ffill(limit=limit)

pad.__doc__ = ffill.__doc__

def nearest(self, limit=None):
"""
Resample by using the nearest value.
Expand Down Expand Up @@ -719,6 +732,22 @@ def bfill(self, limit=None):
return self._upsample("bfill", limit=limit)

def backfill(self, limit=None):
"""
Backward fill the values.

.. deprecated:: 1.4
Use bfill instead.

Parameters
----------
limit : int, optional
Limit of how many values to fill.

Returns
-------
Series, DataFrame
An upsampled Series or DataFrame with backward filled NaN values.
"""
warnings.warn(
"backfill is deprecated and will be removed in a future version. "
"Use bfill instead.",
Expand All @@ -727,8 +756,6 @@ def backfill(self, limit=None):
)
return self.bfill(limit=limit)

backfill.__doc__ = bfill.__doc__

def fillna(self, method, limit=None):
"""
Fill missing values introduced by upsampling.
Expand Down