From 17d64969ab994f38e107f480b3c1bdaafc3b5e6e Mon Sep 17 00:00:00 2001 From: Jeffrey Tratner Date: Tue, 1 Oct 2013 22:18:15 -0400 Subject: [PATCH] Fix order of index methods --- pandas/core/index.py | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/pandas/core/index.py b/pandas/core/index.py index 6d0a7d2f9f86a..f6a88f4164191 100644 --- a/pandas/core/index.py +++ b/pandas/core/index.py @@ -93,35 +93,6 @@ class Index(FrozenNDArray): _engine_type = _index.ObjectEngine - def is_(self, other): - """ - More flexible, faster check like ``is`` but that works through views - - Note: this is *not* the same as ``Index.identical()``, which checks - that metadata is also the same. - - Parameters - ---------- - other : object - other object to compare against. - - Returns - ------- - True if both have same underlying data, False otherwise : bool - """ - # use something other than None to be clearer - return self._id is getattr(other, '_id', Ellipsis) - - def _reset_identity(self): - "Initializes or resets ``_id`` attribute with new object" - self._id = _Identity() - - def view(self, *args, **kwargs): - result = super(Index, self).view(*args, **kwargs) - if isinstance(result, Index): - result._id = self._id - return result - def __new__(cls, data, dtype=None, copy=False, name=None, fastpath=False, **kwargs): @@ -187,6 +158,35 @@ def __new__(cls, data, dtype=None, copy=False, name=None, fastpath=False, subarr._set_names([name]) return subarr + def is_(self, other): + """ + More flexible, faster check like ``is`` but that works through views + + Note: this is *not* the same as ``Index.identical()``, which checks + that metadata is also the same. + + Parameters + ---------- + other : object + other object to compare against. + + Returns + ------- + True if both have same underlying data, False otherwise : bool + """ + # use something other than None to be clearer + return self._id is getattr(other, '_id', Ellipsis) + + def _reset_identity(self): + "Initializes or resets ``_id`` attribute with new object" + self._id = _Identity() + + def view(self, *args, **kwargs): + result = super(Index, self).view(*args, **kwargs) + if isinstance(result, Index): + result._id = self._id + return result + # construction helpers @classmethod def _scalar_data_error(cls, data):