Skip to content

PERF: speed up .ix by moving deprecation string out of __init__ #24747

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 1 commit into from
Jan 13, 2019
Merged
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
17 changes: 8 additions & 9 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,17 +1405,16 @@ class _IXIndexer(_NDFrameIndexer):
See more at :ref:`Advanced Indexing <advanced>`.
"""

def __init__(self, name, obj):

_ix_deprecation_warning = textwrap.dedent("""
.ix is deprecated. Please use
.loc for label based indexing or
.iloc for positional indexing
_ix_deprecation_warning = textwrap.dedent("""
.ix is deprecated. Please use
.loc for label based indexing or
.iloc for positional indexing

See the documentation here:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated""") # noqa
See the documentation here:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated""") # noqa

warnings.warn(_ix_deprecation_warning,
def __init__(self, name, obj):
warnings.warn(self._ix_deprecation_warning,
DeprecationWarning, stacklevel=2)
super(_IXIndexer, self).__init__(name, obj)

Expand Down