We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8628f1 commit 68e70c4Copy full SHA for 68e70c4
pymap3d/timeconv.py
@@ -0,0 +1,17 @@
1
+import numpy as np
2
+from six import string_types
3
+from dateutil.parser import parse
4
+from datetime import datetime
5
+
6
+def str2dt(t):
7
+ """
8
+ output: datetime
9
10
11
+ t = np.atleast_1d(t)
12
+ if isinstance(t[0], string_types):
13
+ t = np.array([parse(T) for T in t])
14
15
+ assert isinstance(t[0], datetime), 'did not convert {} to datetime'.format(type(t[0]))
16
17
+ return t[()] # [()] to pop scalar from 0d array while being OK with ndim>0
0 commit comments