-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
BUG: Take method of NumpyExtensionArray now returns another extension array with the correct dtype. #62502
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
base: main
Are you sure you want to change the base?
BUG: Take method of NumpyExtensionArray now returns another extension array with the correct dtype. #62502
Changes from 13 commits
7a72a06
65511cd
42898c6
333ba45
3ca2e84
b6e45ac
e0ff0d0
eeb3d85
cd2f2aa
468de3f
91442a8
aa3c228
8bacb94
56a329a
040c127
1bdb1f8
3e5836c
b4258f2
e4c3a5b
acdfb62
fd56024
8dcf8b2
f0886de
c174833
aa1c58b
79c3116
3edbc31
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 |
|---|---|---|
|
|
@@ -325,6 +325,37 @@ def test_factorize_unsigned(): | |
| tm.assert_extension_array_equal(res_unique, NumpyExtensionArray(exp_unique)) | ||
|
|
||
|
|
||
| # TODO: Add the smaller width dtypes to the parameter sets of these tests. | ||
| @pytest.mark.parametrize( | ||
| "dtype", | ||
| [np.uint8, np.uint16, np.uint32, np.uint64, np.int8, np.int16, np.int32, np.int64], | ||
jbrockmendel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| def test_take_assigns_floating_point_dtype(dtype): | ||
| # GH#62448. | ||
| array = NumpyExtensionArray(np.array([1, 2, 3], dtype=dtype)) | ||
|
|
||
| result = array.take([-1], allow_fill=True) | ||
|
|
||
| assert result.dtype.numpy_dtype == np.float64 | ||
|
|
||
| result = array.take([-1], allow_fill=True, fill_value=5.0) | ||
|
|
||
| assert result.dtype.numpy_dtype == np.float64 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "dtype", | ||
| [np.uint8, np.uint16, np.uint32, np.uint64, np.int8, np.int16, np.int32, np.int64], | ||
| ) | ||
| def test_take_assigns_integer_dtype_when_fill_disallowed(dtype): | ||
|
||
| # GH#62448. | ||
| array = NumpyExtensionArray(np.array([1, 2, 3], dtype=dtype)) | ||
|
|
||
| result = array.take([-1], allow_fill=False) | ||
|
|
||
| assert result.dtype.numpy_dtype == dtype | ||
|
|
||
|
|
||
| # ---------------------------------------------------------------------------- | ||
| # Output formatting | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.