You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add support for empty lists to the .isin() function, so that .isin([]) returns a filter that’s identically false? Seems like an edge case that would be worth having – I just ran into it in my code where I have a filter like ~ds.col.isin(bad_value_list) to exclude bad values, and found it gave an error on a dataset that didn’t have any bad values to exclude.
From a cursory look at the code that appears pretty straightforward to do; right now the end of the .isin() function has
if isinstance(x, (list, np.ndarray)):
if len(x) > 1:
return ismember(self, x)[0]
elif np.isscalar(x[0]):
return self == x[0]
If len(x) = 0 it hits an error at the “elif np.isscalar(x[0])” line, so I think you could just put an “elif len(x) == 0” before that which has it return a FA of False of the same length as self.
The text was updated successfully, but these errors were encountered:
Would it be possible to add support for empty lists to the .isin() function, so that .isin([]) returns a filter that’s identically false? Seems like an edge case that would be worth having – I just ran into it in my code where I have a filter like ~ds.col.isin(bad_value_list) to exclude bad values, and found it gave an error on a dataset that didn’t have any bad values to exclude.
From a cursory look at the code that appears pretty straightforward to do; right now the end of the .isin() function has
If len(x) = 0 it hits an error at the “elif np.isscalar(x[0])” line, so I think you could just put an “elif len(x) == 0” before that which has it return a FA of False of the same length as self.
The text was updated successfully, but these errors were encountered: