-
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.converison._to_numpy: Add tests for pandas.Series with pandas numeric dtypes #3584
base: main
Are you sure you want to change the base?
Conversation
a7054b9
to
c3471cb
Compare
8489ebe
to
6f966db
Compare
176f511
to
eceff7f
Compare
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
eceff7f
to
6b77f42
Compare
6b77f42
to
7222db2
Compare
As explained in the top post, currently this PR does two things:
After finishing this PR, we have two options:
I'm inclined to option 2. |
Yeah, agree to option 2. Keep the unit tests here, and open a separate PR with the code changes from a4f15cd |
Co-authored-by: Yvonne Fröhlich <[email protected]>
Commit 0615b5b catches bugs of the improved workaround for pandas<2.2. Will see what's happening and how to make the workaround more robust. |
This PR adds tests for pandas.Series with pandas/pyarrow numeric dtypes (in 7222db2).
Tests pass with pandas 2.2 but fail with pandas 2.1. Check https://github.com/GenericMappingTools/pygmt/actions/runs/11714111582/job/32628172796?pr=3584 for details.
The failures are due to upstream pandas v2.2 changes. Previously, all pandas nullable dtypes are converted to np.object_ dtype. Since pandas v2.2, the new rules are (source: https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#to-numpy-for-numpy-nullable-and-arrow-types-converts-to-suitable-numpy-dtype):
Following the first three points, we add the workaround for pandas<2.2 to explicitly specify how to map pandas dtypes into numpy dtypes (a4f15cd). It is an improved version of PR #3505.
Here is the minimal example to understand the behavior change:
With pandas 2.1
With pandas 2.2
Related to #3581, #2848, #3513, #3583.
Wait for #3583.