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: Allow assert_numpy_array_equal to compare nan #10427

Closed
sinhrks opened this issue Jun 24, 2015 · 4 comments
Closed

TST: Allow assert_numpy_array_equal to compare nan #10427

sinhrks opened this issue Jun 24, 2015 · 4 comments
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@sinhrks
Copy link
Member

sinhrks commented Jun 24, 2015

Related to #10373. pandas assert_array_equal needs to be updated to perform nan comparison properly.

import numpy as np
import pandas as pd
import pandas.util.testing as pdt
import numpy.testing.utils as npt

npt.assert_array_equal(np.array([1, np.nan, 3]), np.array([1, np.nan, 3]))
# no AssertionError

pdt.assert_numpy_array_equal(np.array([1, np.nan, 3]), np.array([1, np.nan, 3]))
# AssertionError: [  1.  nan   3.] is not equal to [  1.  nan   3.].
@sinhrks sinhrks added the Testing pandas testing functions or related to the test suite label Jun 24, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone Jun 24, 2015
@jreback
Copy link
Contributor

jreback commented Jun 24, 2015

no, this is the point of array_equivalent. This is on purpose essentially np.array_equal.

most/all of these numpy comparison functions are broken for object dtypes , we don't in general use them. All that said, I don't see the harm in fixing this.

@sinhrks
Copy link
Member Author

sinhrks commented Jul 4, 2015

Thanks. Based on impl, there is no benefit to use assert_numpy_array_equal except for speed?

How about merging with numpy_array_equivalent to avoid confusion, assuming testing time is not so much affected because Series and DataFrame comparison is mostly done by assert_almost_equal.

@jreback
Copy link
Contributor

jreback commented Jul 4, 2015

yes these should be the same

I think assert_numpy_array_equal is used much more

@sinhrks
Copy link
Member Author

sinhrks commented Jul 4, 2015

OK, let's deprecate assert_numpy_array_equivalent. assert_numpy_array_equal is good for typing:)

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

No branches or pull requests

2 participants