-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[ENH] nargsort handles EA with its _values_for_argsort #26854
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
Changes from 10 commits
8f9637c
4460191
2f37a63
707d9e3
5ce8a29
42d7092
f84aad8
7543a84
a65fea3
365afef
fc99129
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 |
---|---|---|
|
@@ -6,8 +6,7 @@ | |
from numpy import nan | ||
import pytest | ||
|
||
from pandas import ( | ||
DataFrame, MultiIndex, Series, array, concat, merge, to_datetime) | ||
from pandas import DataFrame, MultiIndex, Series, array, concat, merge | ||
from pandas.core import common as com | ||
from pandas.core.sorting import ( | ||
decons_group_index, get_group_index, is_int64_overflow_possible, | ||
|
@@ -181,13 +180,6 @@ def test_nargsort(self): | |
exp = list(range(5)) + list(range(105, 110)) + list(range(104, 4, -1)) | ||
tm.assert_numpy_array_equal(result, np.array(exp), check_dtype=False) | ||
|
||
def test_nargsort_datetimearray_warning(self): | ||
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. should we not leave this? 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. FWIW, I don't see the warning on master. It seems to have changed in the meantime. Probably fine to just remove. 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. sure that's cool |
||
# https://github.com/pandas-dev/pandas/issues/25439 | ||
# can be removed once the FutureWarning for np.array(DTA) is removed | ||
data = to_datetime([0, 2, 0, 1]).tz_localize('Europe/Brussels') | ||
with tm.assert_produces_warning(None): | ||
nargsort(data) | ||
|
||
|
||
class TestMerge: | ||
|
||
|
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.
One more question: why do we have this check for ABCIndexClass here? Shouldn't they be treated the same?
I think it'd be more correct to do
on all inputs. This will get an ExtensionArray from an Index or Series. Then if the new
items
is_extension_array_dtype, we do the_values_for_argsort
.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.
extract_array
is imported insidenargsort
to avoid circular import.