def __array__(self, dtype=None):
ret = take_1d(self.categories.values, self._codes)<EOL>if dtype and not is_dtype_equal(dtype, self.categories.dtype):<EOL><INDENT>return np.asarray(ret, dtype)<EOL><DEDENT>if is_extension_array_dtype(ret):<EOL><INDENT>ret = np.asarray(ret)<EOL><DEDENT>return ret<EOL>
The numpy array interface.

Returns
-------
numpy.array
    A numpy array of either the specified dtype or,
    if dtype==None (default), the same dtype as
    categorical.categories.dtype.