python - Get day of year from giant list of years, months, and days -
i have 3 giant lists (30,000,000+ elements long) named year, month, , day correspond year, month, , day of month, respectively. 3 lists represent long list of dates. need day of year each date.
my fist thought convert 3 lists onto list of datetime objects, , use method outlined in this thread:
day_of_year = datetime.now().timetuple().tm_yday however, doing appears takes far long.
def f(): doy = [datetime.datetime(y,m,d).timetuple().tm_yday y,m,d in zip(year,month,day)] %timeit f() 1 loop, best of 3: 54.2 s per loop i tried use method outlined in second answer here array of datetime64's, i'm unsure how day of year this.
Comments
Post a Comment