@@ -377,19 +377,21 @@ def argwhere(self, key_idx, value, condition="eq"):
377377 + "for string condition checks" )
378378 # Extract columns where condition holds true and return new NavData
379379 if condition == "eq" :
380- new_cols = np .argwhere (np .isin (self [row , :],str_check ))
380+ new_cols = np .argwhere (np .atleast_1d (np .isin (self [row , :],
381+ str_check )))
381382 else :
382383 # condition == "neq"
383- new_cols = np .argwhere (~ np .isin (self [row , :],str_check ))
384+ new_cols = np .argwhere (np .atleast_1d (~ np .isin (self [row , :],
385+ str_check )))
384386
385387 else :
386388 # Values in row are numerical
387389 # Find columns where value can be found and return new NavData
388390 if condition == "eq" :
389391 if isinstance (value ,(np .ndarray ,list ,tuple ,set )):
390392 # use numpy's isin() condition if list of values
391- new_cols = np .argwhere (np .isin (self .array [row , :],
392- value ))
393+ new_cols = np .argwhere (np .atleast_1d ( np . isin (self .array [row , :],
394+ value )))
393395 elif not isinstance (value ,str ) and np .isnan (value ):
394396 # check isinstance b/c np.isnan can't handle strings
395397 new_cols = np .argwhere (np .isnan (self .array [row , :]))
@@ -398,11 +400,11 @@ def argwhere(self, key_idx, value, condition="eq"):
398400 elif condition == "neq" :
399401 if isinstance (value ,(np .ndarray ,list ,tuple ,set )):
400402 # use numpy's isin() condition if list of values
401- new_cols = np .argwhere (~ np .isin (self .array [row , :],
402- value ))
403+ new_cols = np .argwhere (np . atleast_1d ( ~ np .isin (self .array [row , :],
404+ value )))
403405 elif not isinstance (value ,str ) and np .isnan (value ):
404406 # check isinstance b/c np.isnan can't handle strings
405- new_cols = np .argwhere (~ np .isnan (self .array [row , :]))
407+ new_cols = np .argwhere (np . atleast_1d ( ~ np .isnan (self .array [row , :]) ))
406408 else :
407409 new_cols = np .argwhere (self .array [row , :]!= value )
408410 elif condition == "leq" :
0 commit comments