From b6455da7aa3103e5307a8a9c4bc36f6b9e22e61a Mon Sep 17 00:00:00 2001 From: Benjamin Blouin <3keepmovingforward3@users.noreply.github.com> Date: Sun, 7 Mar 2021 04:50:12 -0500 Subject: [PATCH] Update rt_categorical.py Handles passing empty list by actually checking if there is one element; >>>>rt.Cat([1]).isin([]) _categorical_compare_check raise ValueError("List was empty.") >>> rt.Cat([1]).isin([1]) FastArray([ True]) >>> rt.Cat([1]).isin([2]) FastArray([False]) >>> rt.Cat([1]).isin([1,2]) FastArray([ True]) --- riptable/rt_categorical.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/riptable/rt_categorical.py b/riptable/rt_categorical.py index 31b98073..99b6cf5b 100644 --- a/riptable/rt_categorical.py +++ b/riptable/rt_categorical.py @@ -3105,8 +3105,8 @@ def isin(self, values) -> FastArray: if isinstance(x, (list, np.ndarray)): if len(x) > 1: return ismember(self, x)[0] - elif np.isscalar(x[0]): - return self == x[0] + elif np.isscalar(x): + return self == x return self == x # -------------------------------------------------------