Skip to content
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

Add the private _to_numpy function to convert anything to a numpy array #3581

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Nov 5, 2024

This PR adds a new private function, _to_numpy, designed to convert various data types into numpy dtypes. This function is extracted from the existing vectors_to_arrays function without any code changes, greatly simplifying the vectors_to_arrays function.

This enhancement is the first step towards supporting more numpy/pandas/pyarrow dtypes. With this PR, we can easily check if a dtype can be converted to a recognized numpy dtype (see #3513 for a POC PR). The plan is to add more tests for various dtypes in a series of PRs.

Related to #2848 (comment), #3513, #2800, #2933, #3507.

@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Nov 5, 2024
@seisman seisman added this to the 0.14.0 milestone Nov 5, 2024
@seisman seisman force-pushed the refactor/_to_numpy branch from e318764 to 0f8d82f Compare November 5, 2024 07:38
@michaelgrund 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 5, 2024
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
pygmt/clib/conversion.py Outdated Show resolved Hide resolved
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Nov 5, 2024
@seisman seisman merged commit 1a62c72 into main Nov 5, 2024
17 of 21 checks passed
@seisman seisman deleted the refactor/_to_numpy branch November 5, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants