MCPcopy
hub / github.com/pandas-dev/pandas / _maybe_cast_indexer

Method _maybe_cast_indexer

pandas/core/indexes/base.py:6814–6827  ·  view source on GitHub ↗

If we have a float key and are not a floating index, then try to cast to an int if equivalent.

(self, key)

Source from the content-addressed store, hash-verified

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 """

Callers 2

get_locMethod · 0.95

Calls 1

is_nan_naFunction · 0.90

Tested by

no test coverage detected