From e040de5a0620939d0e7e133dbb9e856fb232135a Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Mon, 20 Mar 2023 14:43:13 +0000 Subject: [PATCH 1/2] add __invert__ --- spec/API_specification/dataframe_api/dataframe_object.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 7de9d006..7e1fb837 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -418,6 +418,12 @@ def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]: """ ... + def __invert__(self) -> DataFrame: + """ + Invert truthiness of (boolean) elements. + """ + ... + def any(self, skipna: bool = True) -> DataFrame: """ Reduction returns a 1-row DataFrame. From 3082b48fabe9eaf5be767412f67f86771a242d0b Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Mon, 3 Apr 2023 08:43:47 +0100 Subject: [PATCH 2/2] document that valueerror must be raised if called in non-boolean dataframe --- .../dataframe_api/dataframe_object.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 7e1fb837..cf3d1a69 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -421,18 +421,33 @@ def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]: def __invert__(self) -> DataFrame: """ Invert truthiness of (boolean) elements. + + Raises + ------ + ValueError + If any of the DataFrame's columns is not boolean. """ ... def any(self, skipna: bool = True) -> DataFrame: """ Reduction returns a 1-row DataFrame. + + Raises + ------ + ValueError + If any of the DataFrame's columns is not boolean. """ ... def all(self, skipna: bool = True) -> DataFrame: """ Reduction returns a 1-row DataFrame. + + Raises + ------ + ValueError + If any of the DataFrame's columns is not boolean. """ ...