Skip to content

DEPR: Add deprecated index attribute names to deprecation list #21125

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
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
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.23.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Documentation Changes
Bug Fixes
~~~~~~~~~

- tab completion on :class:`Index` in IPython no longer outputs deprecation warnings (:issue:`21125`)

Groupby/Resample/Rolling
^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
3 changes: 2 additions & 1 deletion pandas/core/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

class DirNamesMixin(object):
_accessors = frozenset([])
_deprecations = frozenset(['asobject'])
_deprecations = frozenset(
['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this only adds them to Index, not to Series.
So not sure why you did get warnings for Index, but not for Series in the first place.


def _dir_deletions(self):
""" delete unwanted __dir__ for this object """
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,17 @@ def test_get_duplicates_deprecated(self):
with tm.assert_produces_warning(FutureWarning):
index.get_duplicates()

def test_tab_complete_warning(self, ip):
# https://github.com/pandas-dev/pandas/issues/16409
pytest.importorskip('IPython', minversion="6.0.0")
from IPython.core.completer import provisionalcompleter

code = "import pandas as pd; idx = pd.Index([1, 2])"
ip.run_code(code)
with tm.assert_produces_warning(None):
with provisionalcompleter('ignore'):
list(ip.Completer.completions('idx.', 4))


class TestMixedIntIndex(Base):
# Mostly the tests from common.py for which the results differ
Expand Down