@@ -586,12 +586,11 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
586
586
'''
587
587
Returns
588
588
-------
589
- is_monotonic_inc, is_monotonic_dec, is_unique
589
+ is_monotonic_inc, is_monotonic_dec
590
590
'''
591
591
cdef:
592
592
Py_ssize_t i, n
593
593
%(c_type)s prev, cur
594
- bint is_unique = 1
595
594
bint is_monotonic_inc = 1
596
595
bint is_monotonic_dec = 1
597
596
@@ -600,21 +599,20 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
600
599
if n == 1:
601
600
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
602
601
# single value is NaN
603
- return False, False, True
602
+ return False, False
604
603
else:
605
- return True, True, True
604
+ return True, True
606
605
elif n < 2:
607
- return True, True, True
606
+ return True, True
608
607
609
608
if timelike and arr[0] == iNaT:
610
- return False, False, None
609
+ return False, False
611
610
612
611
%(nogil)s
613
612
%(tab)sprev = arr[0]
614
613
%(tab)sfor i in range(1, n):
615
614
%(tab)s cur = arr[i]
616
615
%(tab)s if timelike and cur == iNaT:
617
- %(tab)s is_unique = 0
618
616
%(tab)s is_monotonic_inc = 0
619
617
%(tab)s is_monotonic_dec = 0
620
618
%(tab)s break
@@ -623,20 +621,18 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
623
621
%(tab)s elif cur > prev:
624
622
%(tab)s is_monotonic_dec = 0
625
623
%(tab)s elif cur == prev:
626
- %(tab)s is_unique = 0
624
+ %(tab)s pass # is_unique = 0
627
625
%(tab)s else:
628
626
%(tab)s # cur or prev is NaN
629
- %(tab)s is_unique = 0
630
627
%(tab)s is_monotonic_inc = 0
631
628
%(tab)s is_monotonic_dec = 0
632
629
%(tab)s break
633
630
%(tab)s if not is_monotonic_inc and not is_monotonic_dec:
634
- %(tab)s is_unique = 0
635
631
%(tab)s is_monotonic_inc = 0
636
632
%(tab)s is_monotonic_dec = 0
637
633
%(tab)s break
638
634
%(tab)s prev = cur
639
- return is_monotonic_inc, is_monotonic_dec, is_unique
635
+ return is_monotonic_inc, is_monotonic_dec
640
636
"""
641
637
642
638
map_indices_template = """@cython.wraparound(False)
0 commit comments