0

I am doing 2 pandas dataframe comparison and this is where my assertion is failing.

pd.testing.assert_frame_equal

This is the assertion error

E   AssertionError: DataFrame.iloc[:, 8] (column name="xxxxx") are different
E
E   DataFrame.iloc[:, 8] (column name="xxxxx") values are different (50.0 %)
E   [left]:  [143455434, None]
E   [right]: [143455434, None]

Both left and right are same still it is giving error. Both columns are object types

3
  • I can't help, but I'm getting the same. Perhaps a bug. If I use df1.equals(df2) I get equality, and similarly when I use assert_series_equal on the apparently offending column I get equality too. I did use this answer to help one of my cases pass: stackoverflow.com/questions/43088121/… Commented Feb 3, 2020 at 10:31
  • Strangely I converted them to str and it worked. Could possibly a bug Commented Feb 4, 2020 at 17:28
  • Yep, same here, if I convert to string I get equality. Commented Feb 7, 2020 at 8:58

2 Answers 2

1

I had the same issue. In the end, I used the option check_dtype=False from assert_frame_equal, and the assert works.

... types, who need them?

Sign up to request clarification or add additional context in comments.

Comments

0

Possibly a bug. Workaround is to convert to str and then check

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.