@@ -37,7 +37,7 @@ def get_time_micros(ndarray[int64_t] dtindex):
37
37
ndarray[int64_t] micros
38
38
39
39
micros = np.mod(dtindex, DAY_SECONDS * 1000000000 , dtype = np.int64)
40
- micros //= 1000L L
40
+ micros //= 1000
41
41
return micros
42
42
43
43
@@ -48,12 +48,10 @@ def build_field_sarray(int64_t[:] dtindex):
48
48
Datetime as int64 representation to a structured array of fields
49
49
"""
50
50
cdef:
51
- Py_ssize_t i, count = 0
51
+ Py_ssize_t i, count = len (dtindex)
52
52
npy_datetimestruct dts
53
53
ndarray[int32_t] years, months, days, hours, minutes, seconds, mus
54
54
55
- count = len (dtindex)
56
-
57
55
sa_dtype = [(' Y' , ' i4' ), # year
58
56
(' M' , ' i4' ), # month
59
57
(' D' , ' i4' ), # day
@@ -93,12 +91,11 @@ def get_date_name_field(int64_t[:] dtindex, object field, object locale=None):
93
91
name based on requested field (e.g. weekday_name)
94
92
"""
95
93
cdef:
96
- Py_ssize_t i, count = 0
94
+ Py_ssize_t i, count = len (dtindex)
97
95
ndarray[object ] out, names
98
96
npy_datetimestruct dts
99
97
int dow
100
98
101
- count = len (dtindex)
102
99
out = np.empty(count, dtype = object )
103
100
104
101
if field == ' day_name' or field == ' weekday_name' :
@@ -147,7 +144,7 @@ def get_start_end_field(int64_t[:] dtindex, object field,
147
144
"""
148
145
cdef:
149
146
Py_ssize_t i
150
- int count = 0
147
+ int count = len (dtindex)
151
148
bint is_business = 0
152
149
int end_month = 12
153
150
int start_month = 1
@@ -162,7 +159,6 @@ def get_start_end_field(int64_t[:] dtindex, object field,
162
159
[0 , 31 , 60 , 91 , 121 , 152 , 182 , 213 , 244 , 274 , 305 , 335 , 366 ]],
163
160
dtype = np.int32)
164
161
165
- count = len (dtindex)
166
162
out = np.zeros(count, dtype = ' int8' )
167
163
168
164
if freqstr:
@@ -388,11 +384,10 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
388
384
field and return an array of these values.
389
385
"""
390
386
cdef:
391
- Py_ssize_t i, count = 0
387
+ Py_ssize_t i, count = len (dtindex)
392
388
ndarray[int32_t] out
393
389
npy_datetimestruct dts
394
390
395
- count = len (dtindex)
396
391
out = np.empty(count, dtype = ' i4' )
397
392
398
393
if field == ' Y' :
@@ -551,11 +546,10 @@ def get_timedelta_field(int64_t[:] tdindex, object field):
551
546
field and return an array of these values.
552
547
"""
553
548
cdef:
554
- Py_ssize_t i, count = 0
549
+ Py_ssize_t i, count = len (tdindex)
555
550
ndarray[int32_t] out
556
551
pandas_timedeltastruct tds
557
552
558
- count = len (tdindex)
559
553
out = np.empty(count, dtype = ' i4' )
560
554
561
555
if field == ' days' :
0 commit comments