@@ -15,7 +15,7 @@ cnp.import_array()
1515
1616
1717from ccalendar cimport (get_days_in_month, is_leapyear, dayofweek,
18- get_week_of_year)
18+ get_week_of_year, get_day_of_year )
1919from np_datetime cimport (pandas_datetimestruct, pandas_timedeltastruct,
2020 dt64_to_dtstruct, td64_to_tdstruct)
2121from nattype cimport NPY_NAT
@@ -374,15 +374,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
374374 cdef:
375375 Py_ssize_t i, count = 0
376376 ndarray[int32_t] out
377- ndarray[int32_t, ndim= 2 ] _month_offset
378- int isleap, isleap_prev
379377 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 )
386378
387379 count = len (dtindex)
388380 out = np.empty(count, dtype = ' i4' )
@@ -482,8 +474,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
482474 continue
483475
484476 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)
487478 return out
488479
489480 elif field == ' dow' :
0 commit comments