Skip to content

Compat with numpy dev argsort (radix sort added) #26373

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

Merged
merged 2 commits into from
May 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pandas/compat/numpy/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
easier to adjust to future upstream changes in the analogous numpy signatures.
"""
from collections import OrderedDict
from distutils.version import LooseVersion
from typing import Any, Dict, Optional, Union

from numpy import ndarray
from numpy import __version__ as _np_version, ndarray

from pandas._libs.lib import is_bool, is_integer
from pandas.errors import UnsupportedFunctionCall
Expand Down Expand Up @@ -107,6 +108,12 @@ def validate_argmax_with_skipna(skipna, args, kwargs):
ARGSORT_DEFAULTS['axis'] = -1
ARGSORT_DEFAULTS['kind'] = 'quicksort'
ARGSORT_DEFAULTS['order'] = None

if LooseVersion(_np_version) >= LooseVersion("1.17.0"):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is defined in pandas/compat/numpy/__init__.py, but I don't want to create a circular import.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok here

# GH-26361. NumPy added radix sort and changed default to None.
ARGSORT_DEFAULTS['kind'] = None


validate_argsort = CompatValidator(ARGSORT_DEFAULTS, fname='argsort',
max_fname_arg_count=0, method='both')

Expand Down