def get_loc(self, key, method=None, tolerance=None):
if tolerance is not None:<EOL><INDENT>tolerance = self._convert_tolerance(tolerance, np.asarray(key))<EOL><DEDENT>if isinstance(key, datetime):<EOL><INDENT>if key.tzinfo is None:<EOL><INDENT>key = Timestamp(key, tz=self.tz)<EOL><DEDENT>else:<EOL><INDENT>key = Timestamp(key).tz_convert(self.tz)<EOL><DEDENT>return Index.get_loc(self, key, method, tolerance)<EOL><DEDENT>elif isinstance(key, timedelta):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>.format(cls=type(self).__name__,<EOL>other=type(key).__name__))<EOL><DEDENT>if isinstance(key, time):<EOL><INDENT>if method is not None:<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return self.indexer_at_time(key)<EOL><DEDENT>try:<EOL><INDENT>return Index.get_loc(self, key, method, tolerance)<EOL><DEDENT>except (KeyError, ValueError, TypeError):<EOL><INDENT>try:<EOL><INDENT>return self._get_string_slice(key)<EOL><DEDENT>except (TypeError, KeyError, ValueError, OverflowError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>stamp = Timestamp(key)<EOL>if stamp.tzinfo is not None and self.tz is not None:<EOL><INDENT>stamp = stamp.tz_convert(self.tz)<EOL><DEDENT>else:<EOL><INDENT>stamp = stamp.tz_localize(self.tz)<EOL><DEDENT>return Index.get_loc(self, stamp, method, tolerance)<EOL><DEDENT>except KeyError:<EOL><INDENT>raise KeyError(key)<EOL><DEDENT>except ValueError as e:<EOL><INDENT>if '<STR_LIT>' in str(e):<EOL><INDENT>raise e<EOL><DEDENT>raise KeyError(key)<EOL><DEDENT><DEDENT>
Get integer location for requested label

Returns
-------
loc : int