@@ -37,7 +37,7 @@ def get_time_micros(ndarray[int64_t] dtindex):
3737 ndarray[int64_t] micros
3838
3939 micros = np.mod(dtindex, DAY_SECONDS * 1000000000 , dtype = np.int64)
40- micros //= 1000L L
40+ micros //= 1000
4141 return micros
4242
4343
@@ -48,12 +48,10 @@ def build_field_sarray(int64_t[:] dtindex):
4848 Datetime as int64 representation to a structured array of fields
4949 """
5050 cdef:
51- Py_ssize_t i, count = 0
51+ Py_ssize_t i, count = len (dtindex)
5252 npy_datetimestruct dts
5353 ndarray[int32_t] years, months, days, hours, minutes, seconds, mus
5454
55- count = len (dtindex)
56-
5755 sa_dtype = [(' Y' , ' i4' ), # year
5856 (' M' , ' i4' ), # month
5957 (' D' , ' i4' ), # day
@@ -93,12 +91,11 @@ def get_date_name_field(int64_t[:] dtindex, object field, object locale=None):
9391 name based on requested field (e.g. weekday_name)
9492 """
9593 cdef:
96- Py_ssize_t i, count = 0
94+ Py_ssize_t i, count = len (dtindex)
9795 ndarray[object ] out, names
9896 npy_datetimestruct dts
9997 int dow
10098
101- count = len (dtindex)
10299 out = np.empty(count, dtype = object )
103100
104101 if field == ' day_name' or field == ' weekday_name' :
@@ -147,7 +144,7 @@ def get_start_end_field(int64_t[:] dtindex, object field,
147144 """
148145 cdef:
149146 Py_ssize_t i
150- int count = 0
147+ int count = len (dtindex)
151148 bint is_business = 0
152149 int end_month = 12
153150 int start_month = 1
@@ -162,7 +159,6 @@ def get_start_end_field(int64_t[:] dtindex, object field,
162159 [0 , 31 , 60 , 91 , 121 , 152 , 182 , 213 , 244 , 274 , 305 , 335 , 366 ]],
163160 dtype = np.int32)
164161
165- count = len (dtindex)
166162 out = np.zeros(count, dtype = ' int8' )
167163
168164 if freqstr:
@@ -388,11 +384,10 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
388384 field and return an array of these values.
389385 """
390386 cdef:
391- Py_ssize_t i, count = 0
387+ Py_ssize_t i, count = len (dtindex)
392388 ndarray[int32_t] out
393389 npy_datetimestruct dts
394390
395- count = len (dtindex)
396391 out = np.empty(count, dtype = ' i4' )
397392
398393 if field == ' Y' :
@@ -551,11 +546,10 @@ def get_timedelta_field(int64_t[:] tdindex, object field):
551546 field and return an array of these values.
552547 """
553548 cdef:
554- Py_ssize_t i, count = 0
549+ Py_ssize_t i, count = len (tdindex)
555550 ndarray[int32_t] out
556551 pandas_timedeltastruct tds
557552
558- count = len (tdindex)
559553 out = np.empty(count, dtype = ' i4' )
560554
561555 if field == ' days' :
0 commit comments