@@ -822,6 +822,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
822
822
)
823
823
return self ._shallow_copy (taken )
824
824
825
+ @final
825
826
def _maybe_disallow_fill (self , allow_fill : bool , fill_value , indices ) -> bool :
826
827
"""
827
828
We only use pandas-style take when allow_fill is True _and_
@@ -960,6 +961,7 @@ def __deepcopy__(self, memo=None):
960
961
# --------------------------------------------------------------------
961
962
# Rendering Methods
962
963
964
+ @final
963
965
def __repr__ (self ) -> str_t :
964
966
"""
965
967
Return a string representation for this object.
@@ -1710,6 +1712,7 @@ def droplevel(self, level=0):
1710
1712
1711
1713
return self ._drop_level_numbers (levnums )
1712
1714
1715
+ @final
1713
1716
def _drop_level_numbers (self , levnums : List [int ]):
1714
1717
"""
1715
1718
Drop MultiIndex levels by level _number_, not name.
@@ -1827,6 +1830,7 @@ def is_monotonic_decreasing(self) -> bool:
1827
1830
"""
1828
1831
return self ._engine .is_monotonic_decreasing
1829
1832
1833
+ @final
1830
1834
@property
1831
1835
def _is_strictly_monotonic_increasing (self ) -> bool :
1832
1836
"""
@@ -1844,6 +1848,7 @@ def _is_strictly_monotonic_increasing(self) -> bool:
1844
1848
"""
1845
1849
return self .is_unique and self .is_monotonic_increasing
1846
1850
1851
+ @final
1847
1852
@property
1848
1853
def _is_strictly_monotonic_decreasing (self ) -> bool :
1849
1854
"""
@@ -1868,6 +1873,7 @@ def is_unique(self) -> bool:
1868
1873
"""
1869
1874
return self ._engine .is_unique
1870
1875
1876
+ @final
1871
1877
@property
1872
1878
def has_duplicates (self ) -> bool :
1873
1879
"""
@@ -2239,6 +2245,7 @@ def _is_all_dates(self) -> bool:
2239
2245
return is_datetime_array (ensure_object (self ._values ))
2240
2246
2241
2247
@cache_readonly
2248
+ @final
2242
2249
def is_all_dates (self ):
2243
2250
"""
2244
2251
Whether or not the index values only consist of dates.
@@ -3269,6 +3276,7 @@ def get_loc(self, key, method=None, tolerance=None):
3269
3276
"""
3270
3277
3271
3278
@Appender (_index_shared_docs ["get_indexer" ] % _index_doc_kwargs )
3279
+ @final
3272
3280
def get_indexer (
3273
3281
self , target , method = None , limit = None , tolerance = None
3274
3282
) -> np .ndarray :
@@ -3328,6 +3336,7 @@ def _get_indexer(
3328
3336
3329
3337
return ensure_platform_int (indexer )
3330
3338
3339
+ @final
3331
3340
def _check_indexing_method (self , method ):
3332
3341
"""
3333
3342
Raise if we have a get_indexer `method` that is not supported or valid.
@@ -4542,7 +4551,7 @@ def putmask(self, mask, value):
4542
4551
np .putmask (values , mask , converted )
4543
4552
return self ._shallow_copy (values )
4544
4553
4545
- def equals (self , other : object ) -> bool :
4554
+ def equals (self , other : Any ) -> bool :
4546
4555
"""
4547
4556
Determine if two Index object are equal.
4548
4557
@@ -5104,6 +5113,7 @@ def get_indexer_for(self, target, **kwargs):
5104
5113
indexer , _ = self .get_indexer_non_unique (target )
5105
5114
return indexer
5106
5115
5116
+ @final
5107
5117
def _get_indexer_non_comparable (self , target : Index , method , unique : bool = True ):
5108
5118
"""
5109
5119
Called from get_indexer or get_indexer_non_unique when the target
@@ -5142,7 +5152,7 @@ def _get_indexer_non_comparable(self, target: Index, method, unique: bool = True
5142
5152
return no_matches , missing
5143
5153
5144
5154
@property
5145
- def _index_as_unique (self ):
5155
+ def _index_as_unique (self ) -> bool :
5146
5156
"""
5147
5157
Whether we should treat this as unique for the sake of
5148
5158
get_indexer vs get_indexer_non_unique.
@@ -5178,6 +5188,7 @@ def _maybe_promote(self, other: Index):
5178
5188
5179
5189
return self , other
5180
5190
5191
+ @final
5181
5192
def _should_compare (self , other : Index ) -> bool :
5182
5193
"""
5183
5194
Check if `self == other` can ever have non-False entries.
@@ -5786,10 +5797,6 @@ def _cmp_method(self, other, op):
5786
5797
with np .errstate (all = "ignore" ):
5787
5798
result = ops .comp_method_OBJECT_ARRAY (op , self ._values , other )
5788
5799
5789
- elif is_interval_dtype (self .dtype ):
5790
- with np .errstate (all = "ignore" ):
5791
- result = op (self ._values , np .asarray (other ))
5792
-
5793
5800
else :
5794
5801
with np .errstate (all = "ignore" ):
5795
5802
result = ops .comparison_op (self ._values , other , op )
@@ -5808,6 +5815,7 @@ def _arith_method(self, other, op):
5808
5815
return (Index (result [0 ]), Index (result [1 ]))
5809
5816
return Index (result )
5810
5817
5818
+ @final
5811
5819
def _unary_method (self , op ):
5812
5820
result = op (self ._values )
5813
5821
return Index (result , name = self .name )
0 commit comments