pandas.DataFrame.from_records

pandas 3.1.1 · DataFrame · method

Build a DataFrame from record-like rows or a structured array.

Call syntax

DataFrame.from_records(data, index=None, exclude=None, columns=None, coerce_float=False, nrows=None)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
data Required
Positional or keyword
structured ndarray, iterable of tuples or dicts, or dict

Provide the input data read, transformed, or stored by this call.

index Optional
Positional or keyword
Default None
str, list of fields, array-like

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

exclude Optional
Positional or keyword
Default None
sequence

Specify the types or fields that should be excluded.

columns Optional
Positional or keyword
Default None
sequence

Supply column labels or control how columns are handled.

coerce_float Optional
Positional or keyword
Default False
bool

Attempt to convert compatible nonfloating values to floating-point values.

nrows Optional
Positional or keyword
Default None
int

Limit the number of rows to read or display.

Returns

DataFrame