pandas.DataFrame.eval — pandas 0.16.2 documentation (original) (raw)
DataFrame.eval(expr, **kwargs)¶
Evaluate an expression in the context of the calling DataFrame instance.
Parameters: | expr : string The expression string to evaluate. kwargs : dict See the documentation for eval() for complete details on the keyword arguments accepted byquery(). |
---|---|
Returns: | ret : ndarray, scalar, or pandas object |
Notes
For more details see the API documentation for eval(). For detailed examples see enhancing performance with eval.
Examples
from numpy.random import randn from pandas import DataFrame df = DataFrame(randn(10, 2), columns=list('ab')) df.eval('a + b') df.eval('c = a + b')