If we have a float key and are not a floating index, then try to cast to an int if equivalent.
(self, key)
| 6812 | return slice(start_slice, end_slice, step) |
| 6813 | |
| 6814 | def _maybe_cast_indexer(self, key): |
| 6815 | """ |
| 6816 | If we have a float key and are not a floating index, then try to cast |
| 6817 | to an int if equivalent. |
| 6818 | """ |
| 6819 | if ( |
| 6820 | is_float(key) |
| 6821 | and np.isnan(key) |
| 6822 | and isinstance(self.dtype, FloatingDtype) |
| 6823 | and is_nan_na() |
| 6824 | ): |
| 6825 | # TODO: better place to do this? |
| 6826 | key = self.dtype.na_value |
| 6827 | return key |
| 6828 | |
| 6829 | def _maybe_cast_listlike_indexer(self, target) -> Index: |
| 6830 | """ |
no test coverage detected