-
Notifications
You must be signed in to change notification settings - Fork 224
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 pyarrow.array with pyarrow string types #3608
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 tasks
seisman
added
maintenance
Boring but important stuff for the core devs
needs review
This PR has higher priority and needs review.
labels
Nov 11, 2024
seisman
force-pushed
the
to_numpy/pyarrow_string
branch
from
November 11, 2024 09:48
8bfac8e
to
f10175f
Compare
michaelgrund
approved these changes
Nov 12, 2024
michaelgrund
added
final review call
This PR requires final review and approval from a second reviewer
and removed
needs review
This PR has higher priority and needs review.
labels
Nov 12, 2024
I plan to cherry-pick f10175f into a separate PR to have an entry in the "Enhancement" category. |
seisman
commented
Nov 14, 2024
pygmt/clib/conversion.py
Outdated
@@ -173,7 +178,7 @@ def _to_numpy(data: Any) -> np.ndarray: | |||
# we can remove the workaround in PyGMT v0.17.0. | |||
array = np.ascontiguousarray(data.astype(float)) | |||
else: | |||
vec_dtype = str(getattr(data, "dtype", "")) | |||
vec_dtype = str(getattr(data, "dtype", getattr(data, "type", ""))) |
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.
pyarrow array only has .type
, not .dtype
.
seisman
commented
Nov 14, 2024
weiji14
approved these changes
Nov 14, 2024
7 tasks
seisman
added
skip-changelog
Skip adding Pull Request to changelog
and removed
final review call
This PR requires final review and approval from a second reviewer
labels
Nov 15, 2024
10 tasks
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
maintenance
Boring but important stuff for the core devs
skip-changelog
Skip adding Pull Request to changelog
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
This PR adds tests for PyArrow string types:
string
/utf8
/large_string
/large_utf8
/string_view
(xref: https://arrow.apache.org/docs/python/api/datatypes.html).None of them can be converted to np.str_ directly, so we need to mapping them explicitly.