8000 API: Deprecate renamae_axis and reindex_axis by TomAugspurger · Pull Request #17842 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

API: Deprecate renamae_axis and reindex_axis #17842

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 9 commits into from
Oct 11, 2017
Merged
Prev Previous commit
Next Next commit
fixup! API: Deprecate renamae_axis and reindex_axis
  • Loading branch information
TomAugspurger committed Oct 10, 2017
commit d4baabfd229df03b02f12d56046df350dd72ad7e
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ Deprecations
- Passing a non-existent column in ``.to_excel(..., columns=)`` is deprecated and will raise a ``KeyError`` in the future (:issue:`17295`)
- ``raise_on_error`` parameter to :func:`Series.where`, :func:`Series.mask`, :func:`DataFrame.where`, :func:`DataFrame.mask` is deprecated, in favor of ``errors=`` (:issue:`14968`)
- Using :meth:`DataFrame.rename_axis` and :meth:`Series.rename_axis` to alter index or column *labels* is now deprecated in favor of using ``.rename``. ``rename_axis`` may still be used to alter the name of the index or columns (:issue:`17833`).
- :meth:`~NDFrame.reindex_axis` has been deprecated in favor of :meth:`~NDFrame.reindex`. See :ref`here` <whatsnew_0210.enhancements.rename_reindex_axis> for more (:issue:`17833`).
- :meth:`~DataFrame.reindex_axis` has been deprecated in favor of :meth:`~DataFrame.reindex`. See :ref`here` <whatsnew_0210.enhancements.rename_reindex_axis> for more (:issue:`17833`).

.. _whatsnew_0210.deprecations.select:

Expand Down
3 changes: 1 addition & 2 deletions pandas/core/computation/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ def _align_core(terms):
for axis, items in zip(range(ndim), axes):
ti = terms[i].value

# TODO: handle this for when reindex_axis is removed...
if hasattr(ti, 'reindex_axis'):
if hasattr(ti, 'reindex'):
transpose = isinstance(ti, pd.Series) and naxes > 1
reindexer = axes[naxes - 1] if transpose else items

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, data, axes=None, copy=False, dtype=None,

if axes is not None:
for i, ax in enumerate(axes):
data = data.reindex(ax, axis=i)
data = data.reindex_axis(ax, axis=i)

object.__setattr__(self, 'is_copy', None)
object.__setattr__(self, '_data', data)
Expand Down Expand Up @@ -963,7 +963,7 @@ def rename_axis(self, mapper, axis=0, copy=True, inplace=False):

See Also
--------
pandas.NDFrame.rename
pandas.Series.rename, pandas.DataFrame.rename
pandas.Index.rename

Examples
Expand Down
0