@@ -16,29 +16,31 @@ from util cimport (UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX,
16
16
npy_int64_max = np.iinfo(np.int64).max
17
17
18
18
19
- def is_float (object obj ):
19
+ cpdef bint is_float(object obj):
20
20
return util.is_float_object(obj)
21
21
22
22
23
- def is_integer (object obj ):
23
+ cpdef bint is_integer(object obj):
24
24
return util.is_integer_object(obj)
25
25
26
26
27
- def is_bool (object obj ):
27
+ cpdef bint is_bool(object obj):
28
28
return util.is_bool_object(obj)
29
29
30
30
31
- def is_complex (object obj ):
31
+ cpdef bint is_complex(object obj):
32
32
return util.is_complex_object(obj)
33
33
34
34
35
- def is_decimal (object obj ):
35
+ cpdef bint is_decimal(object obj):
36
36
return isinstance (obj, Decimal)
37
37
38
+
38
39
cpdef bint is_period(object val):
39
40
""" Return a boolean if this is a Period object """
40
41
return util.is_period_object(val)
41
42
43
+
42
44
_TYPE_MAP = {
43
45
' categorical' : ' categorical' ,
44
46
' category' : ' categorical' ,
@@ -236,7 +238,7 @@ def infer_dtype(object _values):
236
238
return ' mixed'
237
239
238
240
239
- def is_possible_datetimelike_array (object arr ):
241
+ cpdef bint is_possible_datetimelike_array(object arr):
240
242
# determine if we have a possible datetimelike (or null-like) array
241
243
cdef:
242
244
Py_ssize_t i, n = len (arr)
@@ -321,7 +323,7 @@ cdef inline bint is_timedelta(object o):
321
323
return PyDelta_Check(o) or util.is_timedelta64_object(o)
322
324
323
325
324
- def is_bool_array (ndarray values ):
326
+ cpdef bint is_bool_array(ndarray values):
325
327
cdef:
326
328
Py_ssize_t i, n = len (values)
327
329
ndarray[object ] objbuf
@@ -342,11 +344,7 @@ def is_bool_array(ndarray values):
342
344
return False
343
345
344
346
345
- def is_integer (object o ):
346
- return util.is_integer_object(o)
347
-
348
-
349
- def is_integer_array (ndarray values ):
347
+ cpdef bint is_integer_array(ndarray values):
350
348
cdef:
351
349
Py_ssize_t i, n = len (values)
352
350
ndarray[object ] objbuf
@@ -367,7 +365,7 @@ def is_integer_array(ndarray values):
367
365
return False
368
366
369
367
370
- def is_integer_float_array (ndarray values ):
368
+ cpdef bint is_integer_float_array(ndarray values):
371
369
cdef:
372
370
Py_ssize_t i, n = len (values)
373
371
ndarray[object ] objbuf
@@ -390,7 +388,7 @@ def is_integer_float_array(ndarray values):
390
388
return False
391
389
392
390
393
- def is_float_array (ndarray values ):
391
+ cpdef bint is_float_array(ndarray values):
394
392
cdef:
395
393
Py_ssize_t i, n = len (values)
396
394
ndarray[object ] objbuf
@@ -411,7 +409,7 @@ def is_float_array(ndarray values):
411
409
return False
412
410
413
411
414
- def is_string_array (ndarray values ):
412
+ cpdef bint is_string_array(ndarray values):
415
413
cdef:
416
414
Py_ssize_t i, n = len (values)
417
415
ndarray[object ] objbuf
@@ -433,7 +431,7 @@ def is_string_array(ndarray values):
433
431
return False
434
432
435
433
436
- def is_unicode_array (ndarray values ):
434
+ cpdef bint is_unicode_array(ndarray values):
437
435
cdef:
438
436
Py_ssize_t i, n = len (values)
439
437
ndarray[object ] objbuf
@@ -454,7 +452,7 @@ def is_unicode_array(ndarray values):
454
452
return False
455
453
456
454
457
- def is_bytes_array (ndarray values ):
455
+ cpdef bint is_bytes_array(ndarray values):
458
456
cdef:
459
457
Py_ssize_t i, n = len (values)
460
458
ndarray[object ] objbuf
@@ -475,7 +473,7 @@ def is_bytes_array(ndarray values):
475
473
return False
476
474
477
475
478
- def is_datetime_array (ndarray[object] values ):
476
+ cpdef bint is_datetime_array(ndarray[object ] values):
479
477
cdef Py_ssize_t i, null_count = 0 , n = len (values)
480
478
cdef object v
481
479
if n == 0 :
@@ -493,7 +491,7 @@ def is_datetime_array(ndarray[object] values):
493
491
return null_count != n
494
492
495
493
496
- def is_datetime64_array (ndarray values ):
494
+ cpdef bint is_datetime64_array(ndarray values):
497
495
cdef Py_ssize_t i, null_count = 0 , n = len (values)
498
496
cdef object v
499
497
if n == 0 :
@@ -511,7 +509,7 @@ def is_datetime64_array(ndarray values):
511
509
return null_count != n
512
510
513
511
514
- cpdef is_datetime_with_singletz_array(ndarray[object ] values):
512
+ cpdef bint is_datetime_with_singletz_array(ndarray[object ] values):
515
513
"""
516
514
Check values have the same tzinfo attribute.
517
515
Doesn't check values are datetime-like types.
@@ -539,7 +537,7 @@ cpdef is_datetime_with_singletz_array(ndarray[object] values):
539
537
return True
540
538
541
539
542
- def is_timedelta_array (ndarray values ):
540
+ cpdef bint is_timedelta_array(ndarray values):
543
541
cdef Py_ssize_t i, null_count = 0 , n = len (values)
544
542
cdef object v
545
543
if n == 0 :
@@ -555,7 +553,7 @@ def is_timedelta_array(ndarray values):
555
553
return null_count != n
556
554
557
555
558
- def is_timedelta64_array (ndarray values ):
556
+ cpdef bint is_timedelta64_array(ndarray values):
559
557
cdef Py_ssize_t i, null_count = 0 , n = len (values)
560
558
cdef object v
561
559
if n == 0 :
@@ -571,7 +569,7 @@ def is_timedelta64_array(ndarray values):
571
569
return null_count != n
572
570
573
571
574
- def is_timedelta_or_timedelta64_array (ndarray values ):
572
+ cpdef bint is_timedelta_or_timedelta64_array(ndarray values):
575
573
""" infer with timedeltas and/or nat/none """
576
574
cdef Py_ssize_t i, null_count = 0 , n = len (values)
577
575
cdef object v
@@ -588,7 +586,7 @@ def is_timedelta_or_timedelta64_array(ndarray values):
588
586
return null_count != n
589
587
590
588
591
- def is_date_array (ndarray[object] values ):
589
+ cpdef bint is_date_array(ndarray[object ] values):
592
590
cdef Py_ssize_t i, n = len (values)
593
591
if n == 0 :
594
592
return False
@@ -598,7 +596,7 @@ def is_date_array(ndarray[object] values):
598
596
return True
599
597
600
598
601
- def is_time_array (ndarray[object] values ):
599
+ cpdef bint is_time_array(ndarray[object ] values):
602
600
cdef Py_ssize_t i, n = len (values)
603
601
if n == 0 :
604
602
return False
@@ -608,7 +606,7 @@ def is_time_array(ndarray[object] values):
608
606
return True
609
607
610
608
611
- def is_period_array (ndarray[object] values ):
609
+ cpdef bint is_period_array(ndarray[object ] values):
612
610
cdef Py_ssize_t i, null_count = 0 , n = len (values)
613
611
cdef object v
614
612
if n == 0 :
0 commit comments