We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd66477 commit 0bba51eCopy full SHA for 0bba51e
pygmt/clib/conversion.py
@@ -194,6 +194,11 @@ def _to_numpy(data: Any) -> np.ndarray:
194
195
array = np.ascontiguousarray(data, dtype=numpy_dtype)
196
197
+ # Check if a np.object_ or np.str_ array can be converted to np.datetime64.
198
+ if array.dtype.type in {np.object_, np.str_}:
199
+ with contextlib.suppress(TypeError, ValueError):
200
+ return np.ascontiguousarray(array, dtype=np.datetime64)
201
+
202
# Check if a np.object_ array can be converted to np.str_.
203
if array.dtype == np.object_:
204
with contextlib.suppress(TypeError, ValueError):
0 commit comments