@@ -16,29 +16,31 @@ from util cimport (UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX,
1616npy_int64_max = np.iinfo(np.int64).max
1717
1818
19- def is_float (object obj ):
19+ cpdef bint is_float(object obj):
2020 return util.is_float_object(obj)
2121
2222
23- def is_integer (object obj ):
23+ cpdef bint is_integer(object obj):
2424 return util.is_integer_object(obj)
2525
2626
27- def is_bool (object obj ):
27+ cpdef bint is_bool(object obj):
2828 return util.is_bool_object(obj)
2929
3030
31- def is_complex (object obj ):
31+ cpdef bint is_complex(object obj):
3232 return util.is_complex_object(obj)
3333
3434
35- def is_decimal (object obj ):
35+ cpdef bint is_decimal(object obj):
3636 return isinstance (obj, Decimal)
3737
38+
3839cpdef bint is_period(object val):
3940 """ Return a boolean if this is a Period object """
4041 return util.is_period_object(val)
4142
43+
4244_TYPE_MAP = {
4345 ' categorical' : ' categorical' ,
4446 ' category' : ' categorical' ,
@@ -236,7 +238,7 @@ def infer_dtype(object _values):
236238 return ' mixed'
237239
238240
239- def is_possible_datetimelike_array (object arr ):
241+ cpdef bint is_possible_datetimelike_array(object arr):
240242 # determine if we have a possible datetimelike (or null-like) array
241243 cdef:
242244 Py_ssize_t i, n = len (arr)
@@ -321,7 +323,7 @@ cdef inline bint is_timedelta(object o):
321323 return PyDelta_Check(o) or util.is_timedelta64_object(o)
322324
323325
324- def is_bool_array (ndarray values ):
326+ cpdef bint is_bool_array(ndarray values):
325327 cdef:
326328 Py_ssize_t i, n = len (values)
327329 ndarray[object ] objbuf
@@ -342,11 +344,7 @@ def is_bool_array(ndarray values):
342344 return False
343345
344346
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):
350348 cdef:
351349 Py_ssize_t i, n = len (values)
352350 ndarray[object ] objbuf
@@ -367,7 +365,7 @@ def is_integer_array(ndarray values):
367365 return False
368366
369367
370- def is_integer_float_array (ndarray values ):
368+ cpdef bint is_integer_float_array(ndarray values):
371369 cdef:
372370 Py_ssize_t i, n = len (values)
373371 ndarray[object ] objbuf
@@ -390,7 +388,7 @@ def is_integer_float_array(ndarray values):
390388 return False
391389
392390
393- def is_float_array (ndarray values ):
391+ cpdef bint is_float_array(ndarray values):
394392 cdef:
395393 Py_ssize_t i, n = len (values)
396394 ndarray[object ] objbuf
@@ -411,7 +409,7 @@ def is_float_array(ndarray values):
411409 return False
412410
413411
414- def is_string_array (ndarray values ):
412+ cpdef bint is_string_array(ndarray values):
415413 cdef:
416414 Py_ssize_t i, n = len (values)
417415 ndarray[object ] objbuf
@@ -433,7 +431,7 @@ def is_string_array(ndarray values):
433431 return False
434432
435433
436- def is_unicode_array (ndarray values ):
434+ cpdef bint is_unicode_array(ndarray values):
437435 cdef:
438436 Py_ssize_t i, n = len (values)
439437 ndarray[object ] objbuf
@@ -454,7 +452,7 @@ def is_unicode_array(ndarray values):
454452 return False
455453
456454
457- def is_bytes_array (ndarray values ):
455+ cpdef bint is_bytes_array(ndarray values):
458456 cdef:
459457 Py_ssize_t i, n = len (values)
460458 ndarray[object ] objbuf
@@ -475,7 +473,7 @@ def is_bytes_array(ndarray values):
475473 return False
476474
477475
478- def is_datetime_array (ndarray[object] values ):
476+ cpdef bint is_datetime_array(ndarray[object ] values):
479477 cdef Py_ssize_t i, null_count = 0 , n = len (values)
480478 cdef object v
481479 if n == 0 :
@@ -493,7 +491,7 @@ def is_datetime_array(ndarray[object] values):
493491 return null_count != n
494492
495493
496- def is_datetime64_array (ndarray values ):
494+ cpdef bint is_datetime64_array(ndarray values):
497495 cdef Py_ssize_t i, null_count = 0 , n = len (values)
498496 cdef object v
499497 if n == 0 :
@@ -511,7 +509,7 @@ def is_datetime64_array(ndarray values):
511509 return null_count != n
512510
513511
514- cpdef is_datetime_with_singletz_array(ndarray[object ] values):
512+ cpdef bint is_datetime_with_singletz_array(ndarray[object ] values):
515513 """
516514 Check values have the same tzinfo attribute.
517515 Doesn't check values are datetime-like types.
@@ -539,7 +537,7 @@ cpdef is_datetime_with_singletz_array(ndarray[object] values):
539537 return True
540538
541539
542- def is_timedelta_array (ndarray values ):
540+ cpdef bint is_timedelta_array(ndarray values):
543541 cdef Py_ssize_t i, null_count = 0 , n = len (values)
544542 cdef object v
545543 if n == 0 :
@@ -555,7 +553,7 @@ def is_timedelta_array(ndarray values):
555553 return null_count != n
556554
557555
558- def is_timedelta64_array (ndarray values ):
556+ cpdef bint is_timedelta64_array(ndarray values):
559557 cdef Py_ssize_t i, null_count = 0 , n = len (values)
560558 cdef object v
561559 if n == 0 :
@@ -571,7 +569,7 @@ def is_timedelta64_array(ndarray values):
571569 return null_count != n
572570
573571
574- def is_timedelta_or_timedelta64_array (ndarray values ):
572+ cpdef bint is_timedelta_or_timedelta64_array(ndarray values):
575573 """ infer with timedeltas and/or nat/none """
576574 cdef Py_ssize_t i, null_count = 0 , n = len (values)
577575 cdef object v
@@ -588,7 +586,7 @@ def is_timedelta_or_timedelta64_array(ndarray values):
588586 return null_count != n
589587
590588
591- def is_date_array (ndarray[object] values ):
589+ cpdef bint is_date_array(ndarray[object ] values):
592590 cdef Py_ssize_t i, n = len (values)
593591 if n == 0 :
594592 return False
@@ -598,7 +596,7 @@ def is_date_array(ndarray[object] values):
598596 return True
599597
600598
601- def is_time_array (ndarray[object] values ):
599+ cpdef bint is_time_array(ndarray[object ] values):
602600 cdef Py_ssize_t i, n = len (values)
603601 if n == 0 :
604602 return False
@@ -608,7 +606,7 @@ def is_time_array(ndarray[object] values):
608606 return True
609607
610608
611- def is_period_array (ndarray[object] values ):
609+ cpdef bint is_period_array(ndarray[object ] values):
612610 cdef Py_ssize_t i, null_count = 0 , n = len (values)
613611 cdef object v
614612 if n == 0 :
0 commit comments