@@ -330,26 +330,6 @@ def list_to_object_array(list obj):
330330 return arr
331331
332332
333- @ cython.wraparound (False )
334- @ cython.boundscheck (False )
335- def array_equivalent_object (ndarray left , ndarray right ):
336- cdef Py_ssize_t i, n
337- cdef object lobj, robj
338-
339- n = len (left)
340- for i from 0 <= i < n:
341- lobj = left[i]
342- robj = right[i]
343-
344- # we are either not equal or both nan
345- # I think None == None will be true here
346- if lobj != robj:
347- if checknull(lobj) and checknull(robj):
348- continue
349- return False
350- return True
351-
352-
353333@ cython.wraparound (False )
354334@ cython.boundscheck (False )
355335def fast_unique (ndarray[object] values ):
@@ -692,6 +672,31 @@ def scalar_compare(ndarray[object] values, object val, object op):
692672
693673 return result.view(bool )
694674
675+ @ cython.wraparound (False )
676+ @ cython.boundscheck (False )
677+ def array_equivalent_object (ndarray[object] left , ndarray[object] right ):
678+ """ perform an element by element comparion on 1-d object arrays
679+ taking into account nan positions """
680+ cdef Py_ssize_t i, n
681+ cdef object x, y
682+
683+ n = len (left)
684+ for i from 0 <= i < n:
685+ x = left[i]
686+ y = right[i]
687+
688+ # we are either not equal or both nan
689+ # I think None == None will be true here
690+ if cpython.PyObject_RichCompareBool(x, y, cpython.Py_EQ):
691+ continue
692+ elif _checknull(x) and _checknull(y):
693+ continue
694+ else :
695+ return False
696+
697+ return True
698+
699+
695700@ cython.wraparound (False )
696701@ cython.boundscheck (False )
697702def vec_compare (ndarray[object] left , ndarray[object] right , object op ):
0 commit comments