@@ -14,29 +14,31 @@ from util cimport (UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX,
14
14
# core.common import for fast inference checks
15
15
16
16
17
- def is_float (object obj ):
17
+ cpdef bint is_float(object obj):
18
18
return util.is_float_object(obj)
19
19
20
20
21
- def is_integer (object obj ):
21
+ cpdef bint is_integer(object obj):
22
22
return util.is_integer_object(obj)
23
23
24
24
25
- def is_bool (object obj ):
25
+ cpdef bint is_bool(object obj):
26
26
return util.is_bool_object(obj)
27
27
28
28
29
- def is_complex (object obj ):
29
+ cpdef bint is_complex(object obj):
30
30
return util.is_complex_object(obj)
31
31
32
32
33
- def is_decimal (object obj ):
33
+ cpdef bint is_decimal(object obj):
34
34
return isinstance (obj, Decimal)
35
35
36
+
36
37
cpdef bint is_period(object val):
37
38
""" Return a boolean if this is a Period object """
38
39
return util.is_period_object(val)
39
40
41
+
40
42
_TYPE_MAP = {
41
43
' categorical' : ' categorical' ,
42
44
' category' : ' categorical' ,
@@ -234,7 +236,7 @@ def infer_dtype(object _values):
234
236
return ' mixed'
235
237
236
238
237
- def is_possible_datetimelike_array (object arr ):
239
+ cpdef bint is_possible_datetimelike_array(object arr):
238
240
# determine if we have a possible datetimelike (or null-like) array
239
241
cdef:
240
242
Py_ssize_t i, n = len (arr)
@@ -319,7 +321,7 @@ cdef inline bint is_timedelta(object o):
319
321
return PyDelta_Check(o) or util.is_timedelta64_object(o)
320
322
321
323
322
- def is_bool_array (ndarray values ):
324
+ cpdef bint is_bool_array(ndarray values):
323
325
cdef:
324
326
Py_ssize_t i, n = len (values)
325
327
ndarray[object ] objbuf
@@ -340,11 +342,7 @@ def is_bool_array(ndarray values):
340
342
return False
341
343
342
344
343
- def is_integer (object o ):
344
- return util.is_integer_object(o)
345
-
346
-
347
- def is_integer_array (ndarray values ):
345
+ cpdef bint is_integer_array(ndarray values):
348
346
cdef:
349
347
Py_ssize_t i, n = len (values)
350
348
ndarray[object ] objbuf
@@ -365,7 +363,7 @@ def is_integer_array(ndarray values):
365
363
return False
366
364
367
365
368
- def is_integer_float_array (ndarray values ):
366
+ cpdef bint is_integer_float_array(ndarray values):
369
367
cdef:
370
368
Py_ssize_t i, n = len (values)
371
369
ndarray[object ] objbuf
@@ -388,7 +386,7 @@ def is_integer_float_array(ndarray values):
388
386
return False
389
387
390
388
391
- def is_float_array (ndarray values ):
389
+ cpdef bint is_float_array(ndarray values):
392
390
cdef:
393
391
Py_ssize_t i, n = len (values)
394
392
ndarray[object ] objbuf
@@ -409,7 +407,7 @@ def is_float_array(ndarray values):
409
407
return False
410
408
411
409
412
- def is_string_array (ndarray values ):
410
+ cpdef bint is_string_array(ndarray values):
413
411
cdef:
414
412
Py_ssize_t i, n = len (values)
415
413
ndarray[object ] objbuf
@@ -431,7 +429,7 @@ def is_string_array(ndarray values):
431
429
return False
432
430
433
431
434
- def is_unicode_array (ndarray values ):
432
+ cpdef bint is_unicode_array(ndarray values):
435
433
cdef:
436
434
Py_ssize_t i, n = len (values)
437
435
ndarray[object ] objbuf
@@ -452,7 +450,7 @@ def is_unicode_array(ndarray values):
452
450
return False
453
451
454
452
455
- def is_bytes_array (ndarray values ):
453
+ cpdef bint is_bytes_array(ndarray values):
456
454
cdef:
457
455
Py_ssize_t i, n = len (values)
458
456
ndarray[object ] objbuf
@@ -473,7 +471,7 @@ def is_bytes_array(ndarray values):
473
471
return False
474
472
475
473
476
- def is_datetime_array (ndarray[object] values ):
474
+ cpdef bint is_datetime_array(ndarray[object ] values):
477
475
cdef Py_ssize_t i, null_count = 0 , n = len (values)
478
476
cdef object v
479
477
if n == 0 :
@@ -491,7 +489,7 @@ def is_datetime_array(ndarray[object] values):
491
489
return null_count != n
492
490
493
491
494
- def is_datetime64_array (ndarray values ):
492
+ cpdef bint is_datetime64_array(ndarray values):
495
493
cdef Py_ssize_t i, null_count = 0 , n = len (values)
496
494
cdef object v
497
495
if n == 0 :
@@ -509,7 +507,7 @@ def is_datetime64_array(ndarray values):
509
507
return null_count != n
510
508
511
509
512
- cpdef is_datetime_with_singletz_array(ndarray[object ] values):
510
+ cpdef bint is_datetime_with_singletz_array(ndarray[object ] values):
513
511
"""
514
512
Check values have the same tzinfo attribute.
515
513
Doesn't check values are datetime-like types.
@@ -537,7 +535,7 @@ cpdef is_datetime_with_singletz_array(ndarray[object] values):
537
535
return True
538
536
539
537
540
- def is_timedelta_array (ndarray values ):
538
+ cpdef bint is_timedelta_array(ndarray values):
541
539
cdef Py_ssize_t i, null_count = 0 , n = len (values)
542
540
cdef object v
543
541
if n == 0 :
@@ -553,7 +551,7 @@ def is_timedelta_array(ndarray values):
553
551
return null_count != n
554
552
555
553
556
- def is_timedelta64_array (ndarray values ):
554
+ cpdef bint is_timedelta64_array(ndarray values):
557
555
cdef Py_ssize_t i, null_count = 0 , n = len (values)
558
556
cdef object v
559
557
if n == 0 :
@@ -569,7 +567,7 @@ def is_timedelta64_array(ndarray values):
569
567
return null_count != n
570
568
571
569
572
- def is_timedelta_or_timedelta64_array (ndarray values ):
570
+ cpdef bint is_timedelta_or_timedelta64_array(ndarray values):
573
571
""" infer with timedeltas and/or nat/none """
574
572
cdef Py_ssize_t i, null_count = 0 , n = len (values)
575
573
cdef object v
@@ -586,7 +584,7 @@ def is_timedelta_or_timedelta64_array(ndarray values):
586
584
return null_count != n
587
585
588
586
589
- def is_date_array (ndarray[object] values ):
587
+ cpdef bint is_date_array(ndarray[object ] values):
590
588
cdef Py_ssize_t i, n = len (values)
591
589
if n == 0 :
592
590
return False
@@ -596,7 +594,7 @@ def is_date_array(ndarray[object] values):
596
594
return True
597
595
598
596
599
- def is_time_array (ndarray[object] values ):
597
+ cpdef bint is_time_array(ndarray[object ] values):
600
598
cdef Py_ssize_t i, n = len (values)
601
599
if n == 0 :
602
600
return False
@@ -606,7 +604,7 @@ def is_time_array(ndarray[object] values):
606
604
return True
607
605
608
606
609
- def is_period_array (ndarray[object] values ):
607
+ cpdef bint is_period_array(ndarray[object ] values):
610
608
cdef Py_ssize_t i, null_count = 0 , n = len (values)
611
609
cdef object v
612
610
if n == 0 :
0 commit comments