pandas.api.extensions.ExtensionArray.astype

pandas 3.1.1 · Extensions · method

Convert to another dtype. A DataFrame accepts a mapping to choose conversions column by column.

Call syntax

pd.api.extensions.ExtensionArray.astype(dtype, copy=True)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
dtype Required
Positional or keyword
str or dtype

Choose the data type for the input conversion or result.

copy Optional
Positional or keyword
Default True
bool

Control whether data is copied where the API supports that choice.

Returns

np.ndarray or pandas.api.extensions.ExtensionArray