@@ -1650,7 +1650,7 @@ def _get_grouper_for_level(self, mapper, level=None):
1650
1650
# Introspection Methods
1651
1651
1652
1652
@property
1653
- def is_monotonic (self ):
1653
+ def is_monotonic (self ) -> bool :
1654
1654
"""
1655
1655
Alias for is_monotonic_increasing.
1656
1656
"""
@@ -1691,7 +1691,7 @@ def is_monotonic_decreasing(self) -> bool:
1691
1691
return self ._engine .is_monotonic_decreasing
1692
1692
1693
1693
@property
1694
- def _is_strictly_monotonic_increasing (self ):
1694
+ def _is_strictly_monotonic_increasing (self ) -> bool :
1695
1695
"""
1696
1696
Return if the index is strictly monotonic increasing
1697
1697
(only increasing) values.
@@ -1708,7 +1708,7 @@ def _is_strictly_monotonic_increasing(self):
1708
1708
return self .is_unique and self .is_monotonic_increasing
1709
1709
1710
1710
@property
1711
- def _is_strictly_monotonic_decreasing (self ):
1711
+ def _is_strictly_monotonic_decreasing (self ) -> bool :
1712
1712
"""
1713
1713
Return if the index is strictly monotonic decreasing
1714
1714
(only decreasing) values.
@@ -1725,7 +1725,7 @@ def _is_strictly_monotonic_decreasing(self):
1725
1725
return self .is_unique and self .is_monotonic_decreasing
1726
1726
1727
1727
@cache_readonly
1728
- def is_unique (self ):
1728
+ def is_unique (self ) -> bool :
1729
1729
"""
1730
1730
Return if the index has unique values.
1731
1731
"""
@@ -1735,22 +1735,22 @@ def is_unique(self):
1735
1735
def has_duplicates (self ) -> bool :
1736
1736
return not self .is_unique
1737
1737
1738
- def is_boolean (self ):
1738
+ def is_boolean (self ) -> bool :
1739
1739
return self .inferred_type in ["boolean" ]
1740
1740
1741
- def is_integer (self ):
1741
+ def is_integer (self ) -> bool :
1742
1742
return self .inferred_type in ["integer" ]
1743
1743
1744
- def is_floating (self ):
1744
+ def is_floating (self ) -> bool :
1745
1745
return self .inferred_type in ["floating" , "mixed-integer-float" , "integer-na" ]
1746
1746
1747
- def is_numeric (self ):
1747
+ def is_numeric (self ) -> bool :
1748
1748
return self .inferred_type in ["integer" , "floating" ]
1749
1749
1750
- def is_object (self ):
1750
+ def is_object (self ) -> bool :
1751
1751
return is_object_dtype (self .dtype )
1752
1752
1753
- def is_categorical (self ):
1753
+ def is_categorical (self ) -> bool :
1754
1754
"""
1755
1755
Check if the Index holds categorical data.
1756
1756
@@ -1786,10 +1786,10 @@ def is_categorical(self):
1786
1786
"""
1787
1787
return self .inferred_type in ["categorical" ]
1788
1788
1789
- def is_interval (self ):
1789
+ def is_interval (self ) -> bool :
1790
1790
return self .inferred_type in ["interval" ]
1791
1791
1792
- def is_mixed (self ):
1792
+ def is_mixed (self ) -> bool :
1793
1793
return self .inferred_type in ["mixed" ]
1794
1794
1795
1795
def holds_integer (self ):
@@ -1868,7 +1868,7 @@ def _isnan(self):
1868
1868
@cache_readonly
1869
1869
def _nan_idxs (self ):
1870
1870
if self ._can_hold_na :
1871
- w , = self ._isnan .nonzero ()
1871
+ w = self ._isnan .nonzero ()[ 0 ]
1872
1872
return w
1873
1873
else :
1874
1874
return np .array ([], dtype = np .int64 )
@@ -4086,13 +4086,13 @@ def _assert_can_do_op(self, value):
4086
4086
msg = "'value' must be a scalar, passed: {0}"
4087
4087
raise TypeError (msg .format (type (value ).__name__ ))
4088
4088
4089
- def _is_memory_usage_qualified (self ):
4089
+ def _is_memory_usage_qualified (self ) -> bool :
4090
4090
"""
4091
4091
Return a boolean if we need a qualified .info display.
4092
4092
"""
4093
4093
return self .is_object ()
4094
4094
4095
- def is_type_compatible (self , kind ):
4095
+ def is_type_compatible (self , kind ) -> bool :
4096
4096
"""
4097
4097
Whether the index type is compatible with the provided type.
4098
4098
"""
@@ -4131,14 +4131,14 @@ def is_type_compatible(self, kind):
4131
4131
"""
4132
4132
4133
4133
@Appender (_index_shared_docs ["contains" ] % _index_doc_kwargs )
4134
- def __contains__ (self , key ):
4134
+ def __contains__ (self , key ) -> bool :
4135
4135
hash (key )
4136
4136
try :
4137
4137
return key in self ._engine
4138
4138
except (OverflowError , TypeError , ValueError ):
4139
4139
return False
4140
4140
4141
- def contains (self , key ):
4141
+ def contains (self , key ) -> bool :
4142
4142
"""
4143
4143
Return a boolean indicating whether the provided key is in the index.
4144
4144
@@ -4199,7 +4199,7 @@ def __getitem__(self, key):
4199
4199
else :
4200
4200
return result
4201
4201
4202
- def _can_hold_identifiers_and_holds_name (self , name ):
4202
+ def _can_hold_identifiers_and_holds_name (self , name ) -> bool :
4203
4203
"""
4204
4204
Faster check for ``name in self`` when we know `name` is a Python
4205
4205
identifier (e.g. in NDFrame.__getattr__, which hits this to support
@@ -4290,7 +4290,7 @@ def putmask(self, mask, value):
4290
4290
# coerces to object
4291
4291
return self .astype (object ).putmask (mask , value )
4292
4292
4293
- def equals (self , other ):
4293
+ def equals (self , other ) -> bool :
4294
4294
"""
4295
4295
Determine if two Index objects contain the same elements.
4296
4296
@@ -4314,7 +4314,7 @@ def equals(self, other):
4314
4314
com .values_from_object (self ), com .values_from_object (other )
4315
4315
)
4316
4316
4317
- def identical (self , other ):
4317
+ def identical (self , other ) -> bool :
4318
4318
"""
4319
4319
Similar to equals, but check that other comparable attributes are
4320
4320
also equal.
0 commit comments