def __getitem__(self, key):
is_int = lib.is_integer(key)<EOL>if lib.is_scalar(key) and not is_int:<EOL><INDENT>raise IndexError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>getitem = self._data.__getitem__<EOL>if is_int:<EOL><INDENT>val = getitem(key)<EOL>return self._box_func(val)<EOL><DEDENT>if com.is_bool_indexer(key):<EOL><INDENT>key = np.asarray(key, dtype=bool)<EOL>if key.all():<EOL><INDENT>key = slice(<NUM_LIT:0>, None, None)<EOL><DEDENT>else:<EOL><INDENT>key = lib.maybe_booleans_to_slice(key.view(np.uint8))<EOL><DEDENT><DEDENT>is_period = is_period_dtype(self)<EOL>if is_period:<EOL><INDENT>freq = self.freq<EOL><DEDENT>else:<EOL><INDENT>freq = None<EOL>if isinstance(key, slice):<EOL><INDENT>if self.freq is not None and key.step is not None:<EOL><INDENT>freq = key.step * self.freq<EOL><DEDENT>else:<EOL><INDENT>freq = self.freq<EOL><DEDENT><DEDENT>elif key is Ellipsis:<EOL><INDENT>freq = self.freq<EOL><DEDENT><DEDENT>result = getitem(key)<EOL>if result.ndim > <NUM_LIT:1>:<EOL><INDENT>if is_period:<EOL><INDENT>return self._simple_new(result, dtype=self.dtype, freq=freq)<EOL><DEDENT>return result<EOL><DEDENT>return self._simple_new(result, dtype=self.dtype, freq=freq)<EOL>
This getitem defers to the underlying array, which by-definition can
only handle list-likes, slices, and integer scalars