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

COMPAT: numpy_dev build failing #26361

Closed
jreback opened this issue May 12, 2019 · 2 comments · Fixed by #26373
Closed

COMPAT: numpy_dev build failing #26361

jreback opened this issue May 12, 2019 · 2 comments · Fixed by #26373
Labels
Compat pandas objects compatability with Numpy or Python functions
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented May 12, 2019

https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=11349

I think this was just working

=================================== FAILURES ===================================
______________________ TestRangeIndex.test_numpy_argsort _______________________
[gw1] linux -- Python 3.7.3 /home/vsts/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.indexes.test_range.TestRangeIndex object at 0x7f157c45ff60>

    def test_numpy_argsort(self):
        for k, ind in self.indices.items():
>           result = np.argsort(ind)

pandas/tests/indexes/common.py:331: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/overrides.py:150: in public_api
    implementation, public_api, relevant_args, args, kwargs)
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/fromnumeric.py:1084: in argsort
    return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order)
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/fromnumeric.py:61: in _wrapfunc
    return bound(*args, **kwds)
pandas/core/indexes/range.py:355: in argsort
    nv.validate_argsort(args, kwargs)
pandas/compat/numpy/function.py:56: in __call__
    self.defaults)
pandas/util/_validators.py:218: in validate_args_and_kwargs
    validate_kwargs(fname, kwargs, compat_args)
pandas/util/_validators.py:157: in validate_kwargs
    _check_for_default_values(fname, kwds, compat_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fname = 'argsort', arg_val_dict = {'axis': -1, 'kind': None, 'order': None}
compat_args = OrderedDict([('axis', -1), ('kind', 'quicksort'), ('order', None)])

    def _check_for_default_values(fname, arg_val_dict, compat_args):
        """
        Check that the keys in `arg_val_dict` are mapped to their
        default values as specified in `compat_args`.
    
        Note that this function is to be called only when it has been
        checked that arg_val_dict.keys() is a subset of compat_args
    
        """
        for key in arg_val_dict:
            # try checking equality directly with '=' operator,
            # as comparison may have been overridden for the left
            # hand object
            try:
                v1 = arg_val_dict[key]
                v2 = compat_args[key]
    
                # check for None-ness otherwise we could end up
                # comparing a numpy array vs None
                if (v1 is not None and v2 is None) or \
                   (v1 is None and v2 is not None):
                    match = False
                else:
                    match = (v1 == v2)
    
                if not is_bool(match):
                    raise ValueError("'match' is not a boolean")
    
            # could not compare them directly, so try comparison
            # using the 'is' operator
            except ValueError:
                match = (arg_val_dict[key] is compat_args[key])
    
            if not match:
                raise ValueError(("the '{arg}' parameter is not "
                                  "supported in the pandas "
                                  "implementation of {fname}()".
>                                 format(fname=fname, arg=key)))
E               ValueError: the 'kind' parameter is not supported in the pandas implementation of argsort()

pandas/util/_validators.py:69: ValueError
_________________________ TestIndex.test_numpy_argsort _________________________
[gw0] linux -- Python 3.7.3 /home/vsts/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.indexes.test_base.TestIndex object at 0x7f2124480630>

    def test_numpy_argsort(self):
        for k, ind in self.indices.items():
>           result = np.argsort(ind)

pandas/tests/indexes/common.py:331: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/overrides.py:150: in public_api
    implementation, public_api, relevant_args, args, kwargs)
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/fromnumeric.py:1084: in argsort
    return _wrapfunc(a, 'argsort', axis=axis, kind=kind, order=order)
../../../miniconda3/envs/pandas-dev/lib/python3.7/site-packages/numpy/core/fromnumeric.py:61: in _wrapfunc
    return bound(*args, **kwds)
pandas/core/indexes/range.py:355: in argsort
    nv.validate_argsort(args, kwargs)
pandas/compat/numpy/function.py:56: in __call__
    self.defaults)
pandas/util/_validators.py:218: in validate_args_and_kwargs
    validate_kwargs(fname, kwargs, compat_args)
pandas/util/_validators.py:157: in validate_kwargs
    _check_for_default_values(fname, kwds, compat_args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fname = 'argsort', arg_val_dict = {'axis': -1, 'kind': None, 'order': None}
compat_args = OrderedDict([('axis', -1), ('kind', 'quicksort'), ('order', None)])

    def _check_for_default_values(fname, arg_val_dict, compat_args):
        """
        Check that the keys in `arg_val_dict` are mapped to their
        default values as specified in `compat_args`.
    
        Note that this function is to be called only when it has been
        checked that arg_val_dict.keys() is a subset of compat_args
    
        """
        for key in arg_val_dict:
            # try checking equality directly with '=' operator,
            # as comparison may have been overridden for the left
            # hand object
            try:
                v1 = arg_val_dict[key]
                v2 = compat_args[key]
    
                # check for None-ness otherwise we could end up
                # comparing a numpy array vs None
                if (v1 is not None and v2 is None) or \
                   (v1 is None and v2 is not None):
                    match = False
                else:
                    match = (v1 == v2)
    
                if not is_bool(match):
                    raise ValueError("'match' is not a boolean")
    
            # could not compare them directly, so try comparison
            # using the 'is' operator
            except ValueError:
                match = (arg_val_dict[key] is compat_args[key])
    
            if not match:
                raise ValueError(("the '{arg}' parameter is not "
                                  "supported in the pandas "
                                  "implementation of {fname}()".
>                                 format(fname=fname, arg=key)))
E               ValueError: the 'kind' parameter is not supported in the pandas implementation of argsort()

pandas/util/_validators.py:69: ValueError
@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label May 12, 2019
@jreback jreback added this to the 0.25.0 milestone May 12, 2019
@TomAugspurger
Copy link
Contributor

I'm looking into this now.

@TomAugspurger
Copy link
Contributor

numpy/numpy@12fb101 was the change in NumPy. That changed the default sort implementation for certain cases. We'll need to accept kind='quicksort' or kind=None in our compat validators, depending on the NumPy version. PR coming shortly.

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue May 13, 2019
numpy/numpy@12fb101
adds radix sort to np.argsort. For versions of NumPy with this change
(>=1.17), we need to adjust our validator.

Closes pandas-dev#26361
TomAugspurger added a commit that referenced this issue May 13, 2019
* Compat with numpy dev

numpy/numpy@12fb101
adds radix sort to np.argsort. For versions of NumPy with this change
(>=1.17), we need to adjust our validator.

Closes #26361

* isort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants