From 3e6f901f358dc47d15d58bbde5e736c9d7a669db Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Tue, 2 May 2023 11:10:09 +0100 Subject: [PATCH 1/5] add Column.is_in --- .../dataframe_api/column_object.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index c11da438..2bf4d14d 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -384,3 +384,19 @@ def isnan(self) -> Column: Does *not* include 'missing' or 'null' entries. In particular, does not check for `np.timedelta64('NaT')`. """ + + def is_in(self, values: Sequence[object]) -> Column[bool]: + """ + Indicate whether the value at each row matches any value in `values`. + + Parameters + ---------- + values : Sequence[object] + Values to compare against. May include ``float('nan')`` and + ``namespace.null``. + + Returns + ------- + Column[bool] + """ + ... From 576ffe918118df2613ba9ffe324e07ed19e237be Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Tue, 2 May 2023 14:45:21 +0100 Subject: [PATCH 2/5] make argument Column, note about what happens when comparing nan/null --- spec/API_specification/dataframe_api/column_object.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 2bf4d14d..f12aac75 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -385,15 +385,17 @@ def isnan(self) -> Column: In particular, does not check for `np.timedelta64('NaT')`. """ - def is_in(self, values: Sequence[object]) -> Column[bool]: + def is_in(self, values: Column) -> Column[bool]: """ Indicate whether the value at each row matches any value in `values`. Parameters ---------- - values : Sequence[object] - Values to compare against. May include ``float('nan')`` and - ``namespace.null``. + values : Column + Contains values to compare against. May include ``float('nan')`` and + ``namespace.null``, which which case ``'nan'`` and ``null`` will + respectively return ``True`` even though ``float('nan') == float('nan')`` + isn't ``True``. Returns ------- From d7ab168a52df2ffab4e76a27839a924dfe80ea14 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Wed, 3 May 2023 10:31:43 +0100 Subject: [PATCH 3/5] note that dtypes must match --- spec/API_specification/dataframe_api/column_object.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index f12aac75..2fa2e4be 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -396,6 +396,7 @@ def is_in(self, values: Column) -> Column[bool]: ``namespace.null``, which which case ``'nan'`` and ``null`` will respectively return ``True`` even though ``float('nan') == float('nan')`` isn't ``True``. + The dtype of `values` must match the current column's dtype. Returns ------- From 0274e732f03e90e6271f67552ab98674f190cca3 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Thu, 4 May 2023 18:17:49 +0100 Subject: [PATCH 4/5] typos --- spec/API_specification/dataframe_api/column_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 9943c3b2..fbcdafe8 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -439,7 +439,7 @@ def is_in(self, values: Column) -> Column[bool]: ---------- values : Column Contains values to compare against. May include ``float('nan')`` and - ``namespace.null``, which which case ``'nan'`` and ``null`` will + ``null``, which case ``'nan'`` and ``null`` will respectively return ``True`` even though ``float('nan') == float('nan')`` isn't ``True``. The dtype of `values` must match the current column's dtype. From d67192ba267cd72df38434c33b18e7fc1db88145 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Wed, 10 May 2023 19:31:28 +0200 Subject: [PATCH 5/5] Fix another typo --- spec/API_specification/dataframe_api/column_object.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 9ce899d8..e4c43985 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -439,10 +439,10 @@ def is_in(self, values: Column) -> Column[bool]: ---------- values : Column Contains values to compare against. May include ``float('nan')`` and - ``null``, which case ``'nan'`` and ``null`` will + ``null``, in which case ``'nan'`` and ``null`` will respectively return ``True`` even though ``float('nan') == float('nan')`` isn't ``True``. - The dtype of `values` must match the current column's dtype. + The dtype of ``values`` must match the current column's dtype. Returns -------