Frame filter¶
-
filter
(self, predicate)¶ Select all rows which satisfy a predicate.
Parameters: predicate : function
UDF which evaluates a row to a boolean; rows that answer False are dropped from the Frame
Modifies the current frame to save defined rows and delete everything else.
Examples
For this example, my_frame is a Frame object with lots of data for the attributes of
lizards
,frogs
, andsnakes
. Get rid of everything, except information aboutlizards
andfrogs
:>>> def my_filter(row): ... return row['animal_type'] == 'lizard' or ... row['animal_type'] == "frog" >>> my_frame.filter(my_filter)
The frame now only has data about
lizards
andfrogs
.More information on a UDF can be found at Python User Functions.