pandas_select.label.Everywhere

class Everywhere(cond, columns=None)[source]

Filter rows where all columns match a condition.

Parameters
  • cond (callable or boolean array-like) – Select labels where cond is True. If cond is a callable, it is computed on each column and should return a boolean array.

  • columns (optional) – Subset of columns on which to apply cond.

Examples

>>> df = pd.DataFrame({'A': [1, 1, 4], 'B': [2, -3, 1]}, index=["a", "b", "c"])
>>> df
   A  B
a  1  2
b  1 -3
c  4  1
>>> df.loc[Everywhere(lambda x : x > 0)]
   A  B
a  1  2
c  4  1
>>> df.loc[Everywhere(lambda x : x == 1, columns="A")]
   A  B
a  1  2
b  1 -3