@@ -15,7 +15,7 @@ cnp.import_array()
15
15
16
16
17
17
from ccalendar cimport (get_days_in_month, is_leapyear, dayofweek,
18
- get_week_of_year)
18
+ get_week_of_year, get_day_of_year )
19
19
from np_datetime cimport (pandas_datetimestruct, pandas_timedeltastruct,
20
20
dt64_to_dtstruct, td64_to_tdstruct)
21
21
from nattype cimport NPY_NAT
@@ -374,15 +374,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
374
374
cdef:
375
375
Py_ssize_t i, count = 0
376
376
ndarray[int32_t] out
377
- ndarray[int32_t, ndim= 2 ] _month_offset
378
- int isleap, isleap_prev
379
377
pandas_datetimestruct dts
380
- int mo_off, doy, dow
381
-
382
- _month_offset = np.array(
383
- [[0 , 31 , 59 , 90 , 120 , 151 , 181 , 212 , 243 , 273 , 304 , 334 , 365 ],
384
- [0 , 31 , 60 , 91 , 121 , 152 , 182 , 213 , 244 , 274 , 305 , 335 , 366 ]],
385
- dtype = np.int32 )
386
378
387
379
count = len (dtindex)
388
380
out = np.empty(count, dtype = ' i4' )
@@ -482,8 +474,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
482
474
continue
483
475
484
476
dt64_to_dtstruct(dtindex[i], & dts)
485
- isleap = is_leapyear(dts.year)
486
- out[i] = _month_offset[isleap, dts.month - 1 ] + dts.day
477
+ out[i] = get_day_of_year(dts.year, dts.month, dts.day)
487
478
return out
488
479
489
480
elif field == ' dow' :
0 commit comments