def get_loc(self, key, method=None, tolerance=None):
try:<EOL><INDENT>return self._engine.get_loc(key)<EOL><DEDENT>except KeyError:<EOL><INDENT>if is_integer(key):<EOL><INDENT>raise<EOL><DEDENT>try:<EOL><INDENT>asdt, parsed, reso = parse_time_string(key, self.freq)<EOL>key = asdt<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT>except DateParseError:<EOL><INDENT>raise KeyError("<STR_LIT>".format(key))<EOL><DEDENT>try:<EOL><INDENT>key = Period(key, freq=self.freq)<EOL><DEDENT>except ValueError:<EOL><INDENT>raise KeyError(key)<EOL><DEDENT>try:<EOL><INDENT>ordinal = iNaT if key is NaT else key.ordinal<EOL>if tolerance is not None:<EOL><INDENT>tolerance = self._convert_tolerance(tolerance,<EOL>np.asarray(key))<EOL><DEDENT>return self._int64index.get_loc(ordinal, method, tolerance)<EOL><DEDENT>except KeyError:<EOL><INDENT>raise KeyError(key)<EOL><DEDENT><DEDENT>
Get integer location for requested label

Returns
-------
loc : int