-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clib.conversion._to_numpy: Add tests for pandas.Series with pandas string dtype #3607
Changes from all commits
d3f1611
01ba317
dac7e8e
4364e0d
70dc9a5
6efb1fc
2207c7b
64c271b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1475,7 +1475,7 @@ def virtualfile_from_vectors( | |
# 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 np.issubdtype(array.dtype, np.str_): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
columns = col + 2 | ||
break | ||
|
||
|
@@ -1506,9 +1506,9 @@ def virtualfile_from_vectors( | |
strings = string_arrays[0] | ||
elif len(string_arrays) > 1: | ||
strings = np.array( | ||
[" ".join(vals) for vals in zip(*string_arrays, strict=True)] | ||
[" ".join(vals) for vals in zip(*string_arrays, strict=True)], | ||
dtype=np.str_, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifying |
||
) | ||
strings = np.asanyarray(a=strings, dtype=np.str_) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
self.put_strings( | ||
dataset, family="GMT_IS_VECTOR|GMT_IS_DUPLICATE", strings=strings | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to support pd.Series string like: