From d0821a4c639b259817e17355876eed3f10e499d0 Mon Sep 17 00:00:00 2001 From: Christopher Whelan Date: Sat, 12 Jan 2019 18:30:21 -0800 Subject: [PATCH] PERF: speed up .ix by moving deprecation string out of __init__ --- pandas/core/indexing.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 95bf776b1f19d..bbcde8f3b3305 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -1405,17 +1405,16 @@ class _IXIndexer(_NDFrameIndexer): See more at :ref:`Advanced Indexing `. """ - 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)