def __getitem__(self, key):
<EOL>getitem = self._data.__getitem__<EOL>promote = self._shallow_copy<EOL>if is_scalar(key):<EOL><INDENT>key = com.cast_scalar_indexer(key)<EOL>return getitem(key)<EOL><DEDENT>if isinstance(key, slice):<EOL><INDENT>return promote(getitem(key))<EOL><DEDENT>if com.is_bool_indexer(key):<EOL><INDENT>key = np.asarray(key, dtype=bool)<EOL><DEDENT>key = com.values_from_object(key)<EOL>result = getitem(key)<EOL>if not is_scalar(result):<EOL><INDENT>return promote(result)<EOL><DEDENT>else:<EOL><INDENT>return result<EOL><DEDENT>
Override numpy.ndarray's __getitem__ method to work as desired.

This function adds lists and Series as valid boolean indexers
(ndarrays only supports ndarray with dtype=bool).

If resulting ndim != 1, plain ndarray is returned instead of
corresponding `Index` subclass.