This PR adds select_if and drop_if functionality to dfply.
Usage is like:
df >> select_if(lambda col: mean(col) > 3)
returns a dataframe based on df, where each column has a mean > 3. This means that only numeric columns will be returned, since other columns won't have a mean. Any valid lambda function should be sufficient, so you can use and or or, e.g.
df >> select_if(lambda col: mean(col) > 3 or 'Ideal' in col.values)
Will return a dataframe based on df, where each column either has a mean > 3 or contains the word 'Ideal' somewhere in there.
This PR adds
select_if
anddrop_if
functionality todfply
. Usage is like:df >> select_if(lambda col: mean(col) > 3)
returns a dataframe based on df, where each column has a mean > 3. This means that only numeric columns will be returned, since other columns won't have a mean. Any valid lambda function should be sufficient, so you can use
and
oror
, e.g.df >> select_if(lambda col: mean(col) > 3 or 'Ideal' in col.values)
Will return a dataframe based on df, where each column either has a mean > 3 or contains the word 'Ideal' somewhere in there.