pandas.Series.convert_dtypes

pandas 3.1.1 · Series and accessors · method

Infer dtypes with support for missing values, such as nullable integers or strings.

Call syntax

Series.convert_dtypes(
    infer_objects=…,
    convert_string=…,
    convert_integer=…,
    convert_boolean=…,
    convert_floating=…,
    dtype_backend='numpy_nullable',
)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
infer_objects Optional
Positional or keyword
bool

When omitted, the documented default is True.

convert_string Optional
Positional or keyword
bool

When omitted, the documented default is True.

convert_integer Optional
Positional or keyword
bool

When omitted, the documented default is True.

convert_boolean Optional
Positional or keyword
bool
convert_floating Optional
Positional or keyword
bool
dtype_backend Optional
Positional or keyword
Default 'numpy_nullable'
{'numpy_nullable', 'pyarrow'}

Choose nullable NumPy-backed dtypes or Arrow-backed dtypes.

Returns

Series or DataFrame