eval

eval#

NestedFrame.eval(expr: str, *, inplace: bool = False, **kwargs) Any | None[source]#

Evaluate a string describing operations on NestedFrame columns.

Operates on columns only, not specific rows or elements. This allows eval to run arbitrary code, which can make you vulnerable to code injection if you pass user input to this function.

Works the same way as pd.DataFrame.eval, except that this method will also automatically unpack nested columns into NestedSeries, and the resulting expression will have the dimensions of the unpacked series.

Parameters:
  • expr (str) – The expression string to evaluate.

  • inplace (bool, default False) – If the expression contains an assignment, whether to perform the operation inplace and mutate the existing NestedFrame. Otherwise, a new NestedFrame is returned.

  • **kwargs – See the documentation for pandas.DataFrame.eval() for complete details on the keyword arguments accepted by eval().

Returns:

The result of the evaluation or None if inplace=True.

Return type:

ndarray, scalar, pandas object, nested-pandas object, or None