Skip to content

TST: Better handle np.array_equal() edge cases #5371

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 1 commit into from
Oct 29, 2013

Conversation

jtratner
Copy link
Contributor

No description provided.

@jreback
Copy link
Contributor

jreback commented Oct 29, 2013

ok...

@jtratner
Copy link
Contributor Author

@JeffReback we want to check each element if array_equal doesn't work, right?

@jreback
Copy link
Contributor

jreback commented Oct 29, 2013

I think that if array_equal returns False and they are the same shape/dtype, and both can hold nan (e.g. float/object), then coerce to float and check for nan, otherwise I think its correct, just return False

@jtratner
Copy link
Contributor Author

Well, examples of things that fail:

np.array_equal(np.array([], dtype='M8[ns]'), np.array([], dtype='float64'))

@jreback
Copy link
Contributor

jreback commented Oct 29, 2013

should 0-Len be equal regardless of dtype

if yes then this is trivial

@jtratner
Copy link
Contributor Author

I think so. Also think assert_almost_equal should ignore dtype and callers
should check that. This handles the case shown above.

@jreback
Copy link
Contributor

jreback commented Oct 29, 2013

agree

jtratner added a commit that referenced this pull request Oct 29, 2013
TST: Better handle np.array_equal() edge cases
@jtratner jtratner merged commit 6eba2e4 into pandas-dev:master Oct 29, 2013
@jtratner jtratner deleted the catch-errors-array-equal branch October 29, 2013 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants