pandas.DataFrame.to_numpy
pandas 3.1.1 · DataFrame · method
Convert values to a NumPy array. Mixed columns may require a common dtype.
Call syntax
DataFrame.to_numpy(dtype=None, copy=False, na_value=…)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted 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. |
Returns
numpy.ndarray