pandas.api.extensions.ExtensionArray.astype#

ExtensionArray.astype(dtype, copy=True)[source]#

Cast to a NumPy array or ExtensionArray with ‘dtype’.

Parameters
dtypestr or dtype

Typecode or data-type to which the array is cast.

copybool, default True

Whether to copy the data, even if not necessary. If False, a copy is made only if the old dtype does not match the new dtype.

Returns
np.ndarray or pandas.api.extensions.ExtensionArray

An ExtensionArray if dtype is ExtensionDtype, Otherwise a NumPy ndarray with ‘dtype’ for its dtype.