Pandas DataFrame: eval() function
DataFrame - eval() function
The eval() function evaluates a string describing operations on DataFrame 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.
Syntax:
DataFrame.eval(self, expr, inplace=False, **kwargs)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
expr | The expression string to evaluate. | str | Required |
inplace | If the expression contains an assignment, whether to perform the operation inplace and mutate the existing DataFrame. Otherwise, a new DataFrame is returned. | bool Default Value: False |
Required |
kwargs | See the documentation for eval() for complete details on the keyword arguments accepted by query() | dict |
Returns: ndarray, scalar, or pandas object
The result of the evaluation.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame - diff() function
Next: DataFrame - max() function
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework