Skip to content

Instantly share code, notes, and snippets.

@prateekiiest
Created March 25, 2018 05:20
Show Gist options
  • Save prateekiiest/be2932a25b311153d72fc39401c745f9 to your computer and use it in GitHub Desktop.
Save prateekiiest/be2932a25b311153d72fc39401c745f9 to your computer and use it in GitHub Desktop.
Enhancement for _parse_dt64
import astropy.Time as T
def _parse_dt64(dt):
"""
Parse a single numpy datetime64 object
"""
# Validate (in an agnostic way) that we are getting a datetime rather than a date
s= ((dt.astype(T.Time).timetuple()[:6]))
return T.Time('{}-{}-{}'.format(*s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment