On this page
pandas.api.extensions.ExtensionArray.astype
- ExtensionArray.astype(dtype, copy=True)[source]
-
Cast to a NumPy array or ExtensionArray with ‘dtype’.
- Parameters
-
- dtype:str or dtype
-
Typecode or data-type to which the array is cast.
- copy:bool, 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
-
- array:np.ndarray or ExtensionArray
-
An ExtensionArray if dtype is ExtensionDtype, Otherwise a NumPy ndarray with ‘dtype’ for its dtype.
© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.api.extensions.ExtensionArray.astype.html