def get_loc(self, key, method=None, tolerance=None):
if is_list_like(key) or (isinstance(key, datetime) and key is not NaT):<EOL><INDENT>raise TypeError<EOL><DEDENT>if isna(key):<EOL><INDENT>key = NaT<EOL><DEDENT>if tolerance is not None:<EOL><INDENT>tolerance = self._convert_tolerance(tolerance, np.asarray(key))<EOL><DEDENT>if _is_convertible_to_td(key):<EOL><INDENT>key = Timedelta(key)<EOL>return Index.get_loc(self, key, method, tolerance)<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):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>stamp = Timedelta(key)<EOL>return Index.get_loc(self, stamp, method, tolerance)<EOL><DEDENT>except (KeyError, ValueError):<EOL><INDENT>raise KeyError(key)<EOL><DEDENT><DEDENT>
Get integer location for requested label

Returns
-------
loc : int