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

TST: Test failure on 32bit for TestSparseGroupBy.test_aggfuncs #23605

Closed
jschendel opened this issue Nov 9, 2018 · 4 comments
Closed

TST: Test failure on 32bit for TestSparseGroupBy.test_aggfuncs #23605

jschendel opened this issue Nov 9, 2018 · 4 comments
Labels
32bit 32-bit systems Groupby Sparse Sparse Data Type Testing pandas testing functions or related to the test suite

Comments

@jschendel
Copy link
Member

The test_aggfuncs test in /sparse/test_groupby.py is failing on 32bit: https://travis-ci.org/MacPython/pandas-wheels/jobs/451706570#L5281

Specifically, the pytest output:

_______________________ TestSparseGroupBy.test_aggfuncs ________________________
self = <pandas.tests.sparse.test_groupby.TestSparseGroupBy object at 0xde3f08ec>
    def test_aggfuncs(self):
        sparse_grouped = self.sparse.groupby('A')
        dense_grouped = self.dense.groupby('A')
    
        result = sparse_grouped.mean().to_sparse()
        expected = dense_grouped.mean().to_sparse()
    
>       tm.assert_frame_equal(result, expected)
/venv/lib/python3.6/site-packages/pandas/tests/sparse/test_groupby.py:50: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/venv/lib/python3.6/site-packages/pandas/util/testing.py:1185: in assert_extension_array_equal
    assert_numpy_array_equal(left_valid, right_valid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
left = array([-0.17387645482451206, 0.3414148016424936], dtype=object)
right = array([-0.17387645482451206, 0.3414148016424937], dtype=object)
err_msg = None
    def _raise(left, right, err_msg):
        if err_msg is None:
            if left.shape != right.shape:
                raise_assert_detail(obj, '{obj} shapes are different'
                                    .format(obj=obj), left.shape, right.shape)
    
            diff = 0
            for l, r in zip(left, right):
                # count up differences
                if not array_equivalent(l, r, strict_nan=strict_nan):
                    diff += 1
    
            diff = diff * 100.0 / left.size
            msg = '{obj} values are different ({pct} %)'.format(
                obj=obj, pct=np.round(diff, 5))
>           raise_assert_detail(obj, msg, left, right)
E           AssertionError: numpy array are different
E           
E           numpy array values are different (50.0 %)
E           [left]:  [-0.17387645482451206, 0.3414148016424936]
E           [right]: [-0.17387645482451206, 0.3414148016424937]
/venv/lib/python3.6/site-packages/pandas/util/testing.py:1146: AssertionError

The test in question:

def test_aggfuncs(self):
sparse_grouped = self.sparse.groupby('A')
dense_grouped = self.dense.groupby('A')
result = sparse_grouped.mean().to_sparse()
expected = dense_grouped.mean().to_sparse()

xref #23318 : it looks like this is the pr that caused the change?

cc : @jreback @TomAugspurger @5hirish

@jschendel jschendel added Testing pandas testing functions or related to the test suite Groupby Sparse Sparse Data Type 32bit 32-bit systems labels Nov 9, 2018
@jreback
Copy link
Contributor

jreback commented Nov 14, 2018

can u just change this to be an all close test rather than exact match

@TomAugspurger
Copy link
Contributor

Was this closed by #23660?

@jschendel
Copy link
Member Author

jschendel commented Nov 14, 2018

@TomAugspurger : No, this issue is unrelated to the interval 32bit failures. The #23318 PR I xref'd is what introduced this.

I'm planning to open a new issue in a little bit related to how assert_extension_array_equal handles precision, as right now it basically does exact=True style equality, which is inconsistent with the other assert_*_equal methods. Making the assert_extension_array_equal behavior consistent would resolve this issue without needing to explicitly change the failing test to an all close test.

@jschendel
Copy link
Member Author

It looks like #23808 fixed this issue, as the latest pandas-wheels build appears to include that PR and was successful: https://travis-ci.org/MacPython/pandas-wheels/builds/457775113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32bit 32-bit systems Groupby Sparse Sparse Data Type Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

3 participants