File tree 2 files changed +7
-33
lines changed
2 files changed +7
-33
lines changed Original file line number Diff line number Diff line change @@ -505,38 +505,6 @@ cdef class PeriodEngine(Int64Engine):
505
505
def _call_monotonic (self , values ):
506
506
return super (PeriodEngine, self )._call_monotonic(values.view(' i8' ))
507
507
508
- cdef _maybe_get_bool_indexer(self , object val):
509
- cdef:
510
- ndarray[uint8_t, cast= True ] indexer
511
- ndarray[int64_t] values
512
- int count = 0
513
- Py_ssize_t i, n
514
- int last_true
515
-
516
- if not util.is_integer_object(val):
517
- raise KeyError (val)
518
-
519
- values = self ._get_index_values().view(' i8' )
520
- n = len (values)
521
-
522
- result = np.empty(n, dtype = bool )
523
- indexer = result.view(np.uint8)
524
-
525
- for i in range (n):
526
- if values[i] == val:
527
- count += 1
528
- indexer[i] = 1
529
- last_true = i
530
- else :
531
- indexer[i] = 0
532
-
533
- if count == 0 :
534
- raise KeyError (val)
535
- if count == 1 :
536
- return last_true
537
-
538
- return result
539
-
540
508
def get_indexer (self , values ):
541
509
cdef ndarray[int64_t, ndim= 1 ] ordinals
542
510
@@ -568,6 +536,9 @@ cdef class PeriodEngine(Int64Engine):
568
536
569
537
return super (PeriodEngine, self ).get_indexer_non_unique(ordinal_array)
570
538
539
+ cdef _get_index_values_for_bool_indexer(self ):
540
+ return self ._get_index_values().view(' i8' )
541
+
571
542
572
543
cpdef convert_scalar(ndarray arr, object value):
573
544
# we don't turn integers
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ cdef class {{name}}Engine(IndexEngine):
66
66
raise KeyError(val)
67
67
{{endif}}
68
68
69
- values = self._get_index_values ()
69
+ values = self._get_index_values_for_bool_indexer ()
70
70
n = len(values)
71
71
72
72
result = np.empty(n, dtype=bool)
@@ -86,6 +86,9 @@ cdef class {{name}}Engine(IndexEngine):
86
86
return last_true
87
87
88
88
return result
89
+
90
+ cdef _get_index_values_for_bool_indexer(self):
91
+ return self._get_index_values()
89
92
{{endif}}
90
93
91
94
{{endfor}}
You can’t perform that action at this time.
0 commit comments