@@ -8,7 +8,9 @@ cdef bint PY3 = (sys.version_info[0] >= 3)
88
99from numpy cimport *
1010
11+ # initialize numpy
1112np.import_array()
13+ np.import_ufunc()
1214
1315from libc.stdlib cimport malloc, free
1416
@@ -52,23 +54,15 @@ PyDateTime_IMPORT
5254from tslibs.np_datetime cimport get_timedelta64_value, get_datetime64_value
5355
5456from tslib cimport _check_all_nulls
55- import tslib
56- from tslib import NaT, Timestamp, Timedelta
57- import interval
57+ from tslib import NaT, Timestamp, Timedelta, array_to_datetime
5858from interval import Interval
5959
6060cdef int64_t NPY_NAT = util.get_nat()
6161
6262cimport util
6363from util cimport is_array, _checknull, _checknan
6464
65- cdef extern from " math.h" :
66- double sqrt(double x)
67- double fabs(double )
68-
69- # initialize numpy
70- import_array()
71- import_ufunc()
65+ from libc.math cimport sqrt, fabs
7266
7367
7468def values_from_object (object o ):
@@ -151,7 +145,7 @@ cpdef bint checknull_old(object val):
151145 elif is_array(val):
152146 return False
153147 else :
154- return util. _checknull(val)
148+ return _checknull(val)
155149
156150
157151cpdef bint isposinf_scalar(object val):
@@ -787,13 +781,13 @@ def scalar_binop(ndarray[object] values, object val, object op):
787781 object x
788782
789783 result = np.empty(n, dtype = object )
790- if util. _checknull(val):
784+ if _checknull(val):
791785 result.fill(val)
792786 return result
793787
794788 for i in range (n):
795789 x = values[i]
796- if util. _checknull(x):
790+ if _checknull(x):
797791 result[i] = x
798792 else :
799793 result[i] = op(x, val)
@@ -820,9 +814,9 @@ def vec_binop(ndarray[object] left, ndarray[object] right, object op):
820814 try :
821815 result[i] = op(x, y)
822816 except TypeError :
823- if util. _checknull(x):
817+ if _checknull(x):
824818 result[i] = x
825- elif util. _checknull(y):
819+ elif _checknull(y):
826820 result[i] = y
827821 else :
828822 raise
0 commit comments