pandas.Series.to_numpy

pandas 3.1.1 · Series and accessors · method

Convert values to a NumPy array. Mixed columns may require a common dtype.

Call syntax

Series.to_numpy(dtype=None, copy=False, na_value=…, **kwargs)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
dtype Optional
Positional or keyword
Default None
str or numpy.dtype

Choose the data type for the input conversion or result.

copy Optional
Positional or keyword
Default False
bool

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

na_value Optional
Positional or keyword
Any

Supply the replacement used when an output element is missing.

**kwargs Optional
Additional keyword arguments

Returns

numpy.ndarray