TST: tests comparison on numpy master
See original GitHub issuehttps://travis-ci.org/pandas-dev/pandas/jobs/256013691
this was working a few builds ago. I think maybe some random sorting details, IOW how exactly argsort works can make this fail with either ‘>’ or ‘<’. so ok with changing test to accept either.
________________________ TestMixedIntIndex.test_argsort ________________________
[gw1] linux -- Python 3.6.2 /home/travis/miniconda3/envs/pandas/bin/python
self = <pandas.tests.indexes.test_base.TestMixedIntIndex object at 0x7fe54ca566a0>
def test_argsort(self):
idx = self.create_index()
if PY36:
with tm.assert_raises_regex(TypeError, "'>' not supported"):
> result = idx.argsort()
pandas/tests/indexes/test_base.py:1850:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/util/testing.py:2493: in __exit__
return self.exception_matches(exc_type, exc_value, trace_back)
pandas/util/testing.py:2528: in exception_matches
raise_with_traceback(e, trace_back)
pandas/compat/__init__.py:343: in raise_with_traceback
raise exc.with_traceback(traceback)
pandas/tests/indexes/test_base.py:1850: in test_argsort
result = idx.argsort()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Index([0, 'a', 1, 'b', 2, 'c'], dtype='object'), args = (), kwargs = {}
result = array([0, 'a', 1, 'b', 2, 'c'], dtype=object)
def argsort(self, *args, **kwargs):
"""
Returns the indices that would sort the index and its
underlying data.
Returns
-------
argsorted : numpy array
See also
--------
numpy.ndarray.argsort
"""
result = self.asi8
if result is None:
result = np.array(self)
> return result.argsort(*args, **kwargs)
E AssertionError: "'>' not supported" does not match "'<' not supported between instances of 'str' and 'int'"
pandas/core/indexes/base.py:2102: AssertionError
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Better introspection for comparing numpy arrays #5347 - GitHub
With plain python lists I can do: a = [1, 2, 3] b = [1, 2, 4] assert a == b That does...
Read more >Master NumPy. Here are concepts and tried-tested… - Medium
Introduction To NumPy || Master NumPy in 45min Playlist ... Here is two smart tried and tested strategies to learn very fast:.
Read more >101 NumPy Exercises for Data Analysis (Python) - ML+
The goal of the numpy exercises is to serve as a reference as well as to get you to apply numpy beyond the...
Read more >Test Support (numpy.testing) — NumPy v1.24 Manual
Common test support for all numpy test scripts. ... For background, see the Testing Guidelines ... Compare two arrays relatively to their spacing....
Read more >Pure Python vs NumPy vs TensorFlow Performance Comparison
A performance comparison between pure Python, NumPy, and TensorFlow using a simple linear regression algorithm.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gfyoung : I am looking at the documentation linked from your post. Thanks for offering guidance!
@ysau : Awesome! Thanks for taking this issue up. The problem that @jreback is raising is that the error message we’re checking for is not correct (probably a flakey test).
Thus, all you would need to do is go in and change the expected error message in that test (
TestMixedIntIndex.test_argsort
) inpandas.tests.indexes.test_base.py
to something that would account for both us seeing ‘>’ and ‘<’ in the error message.I think you can just replace
>
with>|<
and everything should be fine.Let us know if you have any other questions!
FYI: documentation for contributing can be found here