pandas.DataFrame.eval

pandas 3.1.1 · DataFrame · method

Evaluate a trusted expression over variables or table columns. A DataFrame call uses its columns as named inputs.

Call syntax

DataFrame.eval(expr, *, inplace=…, **kwargs)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
expr Required
Positional or keyword
str

Provide the expression evaluated by pandas.

inplace Optional
Keyword only
bool

Choose whether to change the existing object. Where supported, an in-place call typically returns None.

**kwargs Optional
Additional keyword arguments

Returns

ndarray, scalar, pandas object, or None