pandas.DataFrame.to_records

pandas 3.1.1 · DataFrame · method

Get a NumPy record array with named fields.

Call syntax

DataFrame.to_records(index=True, column_dtypes=None, index_dtypes=None)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
index Optional
Positional or keyword
Default True
bool

Supply row labels or control how existing row labels are used.

column_dtypes Optional
Positional or keyword
Default None
str, type, dict
index_dtypes Optional
Positional or keyword
Default None
str, type, dict

Returns

numpy.rec.recarray