@@ -681,12 +681,6 @@ def is_monotonic(self):
681
681
def is_unique (self ):
682
682
return not self .duplicated ().any ()
683
683
684
- @cache_readonly
685
- def _hashed_values (self ):
686
- """ return a uint64 ndarray of my hashed values """
687
- from pandas .tools .hashing import hash_tuples
688
- return hash_tuples (self )
689
-
690
684
@cache_readonly
691
685
def _have_mixed_levels (self ):
692
686
""" return a boolean list indicated if we have mixed levels """
@@ -697,15 +691,35 @@ def _inferred_type_levels(self):
697
691
""" return a list of the inferred types, one for each level """
698
692
return [i .inferred_type for i in self .levels ]
699
693
700
- def _as_valid_indexing_key (self , key ):
694
+ @cache_readonly
695
+ def _hashed_values (self ):
696
+ """ return a uint64 ndarray of my hashed values """
697
+ from pandas .tools .hashing import hash_tuples
698
+ return hash_tuples (self )
699
+
700
+ def _hashed_indexing_key (self , key ):
701
701
"""
702
- validate and return our key
702
+ validate and return the hash for the provided key
703
+
704
+ *this is internal for use for the cython routines*
705
+
706
+ Paramters
707
+ ---------
708
+ key : string or tuple
709
+
710
+ Returns
711
+ -------
712
+ np.uint64
713
+
714
+ Notes
715
+ -----
703
716
we need to stringify if we have mixed levels
704
717
705
- this is internal for use for the cython routines
706
718
"""
719
+ from pandas .tools .hashing import hash_tuples
720
+
707
721
if not isinstance (key , tuple ):
708
- return key
722
+ return hash_tuples ( key )
709
723
710
724
if not len (key ) == self .nlevels :
711
725
raise KeyError
@@ -714,8 +728,9 @@ def f(k, stringify):
714
728
if stringify and not isinstance (k , compat .string_types ):
715
729
k = str (k )
716
730
return k
717
- return tuple ([f (k , stringify )
718
- for k , stringify in zip (key , self ._have_mixed_levels )])
731
+ key = tuple ([f (k , stringify )
732
+ for k , stringify in zip (key , self ._have_mixed_levels )])
733
+ return hash_tuples (key )
719
734
720
735
@deprecate_kwarg ('take_last' , 'keep' , mapping = {True : 'last' ,
721
736
False : 'first' })
0 commit comments