-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: NDFrame.equals #5183
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
Comments
Well, there's eq, lt, etc now on NDFrame, why not allow argument to eq This would also be a good opportunity for a recursive=True kwarg to all seems we need a public version of tm.assert_frame_equal maybe equals on generic NDFrame objects http://stackoverflow.com/questions/19322506/pandas-nan-comparison — |
eq and such are element wise operators equals would signify an object comparator |
okay, that's reasonable, so it's just what you have + df1.index.equals(df2.index)? I still hanker to add a recursive all :P (plus you then would not need to copy to values). Also, would it make more sense to do: df1 = df1.values
df2 = df2.values
((df1 == df2) | ((df1 != df1) & (df2 != df2))).all() instead? seems like that could be simpler. Also, I'm assuming you'd want to check if their shapes are compatible or even just the same (so that you can always safely use equals), so maybe: check shape (len(columns), len(index)), then check dtypes, etc. And then would you want to have a check_metadata argument too? (i.e., column names, index names, etc) |
yep in fact these might be a nice replacement for assert_frame_equal (and it's friends) |
what about non-comparable things? |
I think they should return False |
and gotta check for matching shape first b/c of broadcasting |
I'm a little skeptical on the speed benefit for tests, when I profiled things 6 months ago I may have been wrong though. |
@y-p oh...that's not really the reason for this (that's a side benefit)... its the issue of comparing two objects that have nan's in them where if the nan locations match then it should be True (and not False)....so typical |
Fair enough, just apropos #3150. |
seems we need a public version of
tm.assert_frame_equal
maybe
equals
on generic NDFrame objectshttp://stackoverflow.com/questions/19322506/pandas-nan-comparison
seems good on the values comparison (should compare axes/types as well of course)
The text was updated successfully, but these errors were encountered: