Created
November 1, 2016 16:30
-
-
Save blaylockbk/236fca4fd06fb45e5e0f7f5f73e15b51 to your computer and use it in GitHub Desktop.
this method uses numpy vectorized function, which is slightly faster than using a list generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import datetime | |
def datestr_to_datetime(x): | |
return datetime.datetime.strptime(x,'%Y-%m-%dT%H:%M:%SZ') | |
# where dates is some list of dates as a string... | |
# vectorize the function | |
converttime = np.vectorize(datestr_to_datetime) | |
DATES = converttime(dates) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment