pandas_select.label.AllOf

class AllOf(values, axis='columns', level=None)[source]

Same as AnyOf, except that a KeyError is raised for labels that don’t exist.

Parameters
  • values (single label or list-like) – Index or column labels to select

  • axis (default 'columns') – Axis along which the function is applied, {0 or ‘index’, 1 or ‘columns’}

  • level (optional) – Either the integer position of the level or its name. It should only be set if axis targets a MultiIndex, otherwise a IndexError will be raised.

Examples

>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]}, index=["a", "b"])
>>> df
   A  B
a  1  3
b  2  4
>>> df[AllOf(["B", "A"])]
   A  B
a  1  3
b  2  4
>>> df[AllOf(["B", "A", "invalid"])]
Traceback (most recent call last):
...
KeyError: {'invalid'}