dataFrame.rows — filter()
Description
The filter() method of the rows object keeps only the rows for which the specified function returns true.
Signature
dataFrame.rows.filter(function)Argument
function(function)- A function used to determine whether each row should be kept.
- The function receives a
rowobject representing the current row. Column values can be accessed using column names:row["name"]row["age"]
- The function must return a boolean value:
- Keep the row:
true - Remove the row:
false
- Keep the row:
- The function receives a
Example
// keeps rows where value in the column 'age' is greater than or equal to 18
dataFrame.rows.filter(function(row) {
return row["age"] >= 18;
});