@@ -666,6 +666,18 @@ def _has_complex_internals(self):
666
666
667
667
@cache_readonly
668
668
def is_monotonic (self ):
669
+ """
670
+ return if the index is monotonic increasing (only equal or
671
+ increasing) values.
672
+ """
673
+ return self .is_monotonic_increasing
674
+
675
+ @cache_readonly
676
+ def is_monotonic_increasing (self ):
677
+ """
678
+ return if the index is monotonic increasing (only equal or
679
+ increasing) values.
680
+ """
669
681
670
682
# reversed() because lexsort() wants the most significant key last.
671
683
values = [self ._get_level_values (i )
@@ -678,6 +690,14 @@ def is_monotonic(self):
678
690
# we have mixed types and np.lexsort is not happy
679
691
return Index (self .values ).is_monotonic
680
692
693
+ @property
694
+ def is_monotonic_decreasing (self ):
695
+ """
696
+ return if the index is monotonic decreasing (only equal or
697
+ decreasing) values.
698
+ """
699
+ return False
700
+
681
701
@cache_readonly
682
702
def is_unique (self ):
683
703
return not self .duplicated ().any ()
@@ -1921,17 +1941,8 @@ def partial_selection(key, indexer=None):
1921
1941
return partial_selection (key , indexer )
1922
1942
1923
1943
key = tuple (self [indexer ].tolist ()[0 ])
1924
-
1925
- try :
1926
1944
return (self ._engine .get_loc (
1927
1945
_values_from_object (key )), None )
1928
- except ValueError :
1929
- # if we hae a very odd MultiIndex,
1930
- # e.g. with embedded tuples, this might fail
1931
- # TODO: should prob not allow construction of a MI
1932
- # like this in the first place
1933
- return Index (self .values ).get_loc (key )
1934
-
1935
1946
else :
1936
1947
return partial_selection (key )
1937
1948
else :
0 commit comments