Skip to content

Commit

Permalink
No need to use pd.api.types.is_string_dtype anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Oct 13, 2024
1 parent 3661e54 commit 20b9215
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def vectors_to_arrays(vectors: Sequence[Any]) -> list[np.ndarray]:
# If fails, then the array can't be recognized.
if array.dtype.type == np.object_:
try:
array = np.asarray(array, dtype=np.datetime64)
array = np.ascontiguousarray(array, dtype=np.datetime64)
except ValueError:
array = np.asarray(array, dtype=np.str_)
array = np.ascontiguousarray(array, dtype=np.str_)
arrays.append(array)
return arrays

Expand Down
2 changes: 1 addition & 1 deletion pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ def virtualfile_from_vectors(self, *vectors):
# Assumes that first 2 columns contains coordinates like longitude
# latitude, or datetime string types.
for col, array in enumerate(arrays[2:]):
if pd.api.types.is_string_dtype(array.dtype):
if array.dtype.type == np.str_:
columns = col + 2
break

Expand Down

0 comments on commit 20b9215

Please sign in to comment.