

def _convert_scalar_indexer(self, key, kind=None):
    "\n        convert a scalar indexer\n\n        Parameters\n        ----------\n        key : label of the slice bound\n        kind : {'ix', 'loc', 'getitem', 'iloc'} or None\n        "
    assert (kind in ['ix', 'loc', 'getitem', 'iloc', None])
    if (kind == 'iloc'):
        return self._validate_indexer('positional', key, kind)
    if (len(self) and (not isinstance(self, ABCMultiIndex))):
        if ((kind in ['getitem', 'ix']) and is_float(key)):
            if (not self.is_floating()):
                return self._invalid_indexer('label', key)
        elif ((kind in ['loc']) and is_float(key)):
            if (self.inferred_type not in ['floating', 'mixed-integer-float', 'string', 'unicode', 'mixed']):
                return self._invalid_indexer('label', key)
        elif ((kind in ['loc']) and is_integer(key)):
            if (not self.holds_integer()):
                return self._invalid_indexer('label', key)
    return key

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index._convert_scalar_indexer/original