def astype(self, dtype, copy=True):
if is_categorical_dtype(dtype):<EOL><INDENT>dtype = self.dtype.update_dtype(dtype)<EOL>self = self.copy() if copy else self<EOL>if dtype == self.dtype:<EOL><INDENT>return self<EOL><DEDENT>return self._set_dtype(dtype)<EOL><DEDENT>return np.array(self, dtype=dtype, copy=copy)<EOL>
Coerce this type to another dtype

Parameters
----------
dtype : numpy dtype or pandas type
copy : bool, default True
    By default, astype always returns a newly allocated object.
    If copy is set to False and dtype is categorical, the original
    object is returned.

    .. versionadded:: 0.19.0