@@ -363,115 +363,6 @@ cdef class IndexEngine:
363
363
364
364
return result[0 :count], missing[0 :count_missing]
365
365
366
- cdef class Int64Engine(IndexEngine):
367
-
368
- cdef _get_index_values(self ):
369
- return algos.ensure_int64(self .vgetter())
370
-
371
- cdef _make_hash_table(self , n):
372
- return _hash.Int64HashTable(n)
373
-
374
- def _call_monotonic (self , values ):
375
- return algos.is_monotonic_int64(values, timelike = False )
376
-
377
- def get_pad_indexer (self , other , limit = None ):
378
- return algos.pad_int64(self ._get_index_values(), other,
379
- limit = limit)
380
-
381
- def get_backfill_indexer (self , other , limit = None ):
382
- return algos.backfill_int64(self ._get_index_values(), other,
383
- limit = limit)
384
-
385
- cdef _check_type(self , object val):
386
- hash (val)
387
- if util.is_bool_object(val):
388
- raise KeyError (val)
389
- elif util.is_float_object(val):
390
- raise KeyError (val)
391
-
392
- cdef _maybe_get_bool_indexer(self , object val):
393
- cdef:
394
- ndarray[uint8_t, cast= True ] indexer
395
- ndarray[int64_t] values
396
- int count = 0
397
- Py_ssize_t i, n
398
- int64_t ival
399
- int last_true
400
-
401
- if not util.is_integer_object(val):
402
- raise KeyError (val)
403
-
404
- ival = val
405
-
406
- values = self ._get_index_values()
407
- n = len (values)
408
-
409
- result = np.empty(n, dtype = bool )
410
- indexer = result.view(np.uint8)
411
-
412
- for i in range (n):
413
- if values[i] == val:
414
- count += 1
415
- indexer[i] = 1
416
- last_true = i
417
- else :
418
- indexer[i] = 0
419
-
420
- if count == 0 :
421
- raise KeyError (val)
422
- if count == 1 :
423
- return last_true
424
-
425
- return result
426
-
427
- cdef class Float64Engine(IndexEngine):
428
-
429
- cdef _make_hash_table(self , n):
430
- return _hash.Float64HashTable(n)
431
-
432
- cdef _get_index_values(self ):
433
- return algos.ensure_float64(self .vgetter())
434
-
435
- cdef _maybe_get_bool_indexer(self , object val):
436
- cdef:
437
- ndarray[uint8_t] indexer
438
- ndarray[float64_t] values
439
- int count = 0
440
- Py_ssize_t i, n
441
- int last_true
442
-
443
- values = self ._get_index_values()
444
- n = len (values)
445
-
446
- result = np.empty(n, dtype = bool )
447
- indexer = result.view(np.uint8)
448
-
449
- for i in range (n):
450
- if values[i] == val:
451
- count += 1
452
- indexer[i] = 1
453
- last_true = i
454
- else :
455
- indexer[i] = 0
456
-
457
- if count == 0 :
458
- raise KeyError (val)
459
- if count == 1 :
460
- return last_true
461
-
462
- return result
463
-
464
- def _call_monotonic (self , values ):
465
- return algos.is_monotonic_float64(values, timelike = False )
466
-
467
- def get_pad_indexer (self , other , limit = None ):
468
- return algos.pad_float64(self ._get_index_values(), other,
469
- limit = limit)
470
-
471
- def get_backfill_indexer (self , other , limit = None ):
472
- return algos.backfill_float64(self ._get_index_values(), other,
473
- limit = limit)
474
-
475
366
476
367
cdef Py_ssize_t _bin_search(ndarray values, object val) except - 1 :
477
368
cdef:
@@ -510,22 +401,6 @@ _backfill_functions = {
510
401
' float64' : algos.backfill_float64
511
402
}
512
403
513
- cdef class ObjectEngine(IndexEngine):
514
-
515
- cdef _make_hash_table(self , n):
516
- return _hash.PyObjectHashTable(n)
517
-
518
- def _call_monotonic (self , values ):
519
- return algos.is_monotonic_object(values, timelike = False )
520
-
521
- def get_pad_indexer (self , other , limit = None ):
522
- return algos.pad_object(self ._get_index_values(), other,
523
- limit = limit)
524
-
525
- def get_backfill_indexer (self , other , limit = None ):
526
- return algos.backfill_object(self ._get_index_values(), other,
527
- limit = limit)
528
-
529
404
530
405
cdef class DatetimeEngine(Int64Engine):
531
406
@@ -668,3 +543,7 @@ cdef inline _to_i8(object val):
668
543
669
544
cdef inline bint _is_utc(object tz):
670
545
return tz is UTC or isinstance (tz, _du_utc)
546
+
547
+
548
+ # Generated from template.
549
+ include " index_class_helper.pxi"
0 commit comments