Skip to content
Advertisement

What is the difference between `assert_frame_equal` and `equals`

I’m curious to find the difference between assert_frame_equal and equal. Both are for checking the equality of two data. It applies for assert_series_equal and assert_index_equal. So what is the difference between equals and testing functions?

So far I found was testing functions gives little more flexibility to compare the values, like check_dtpye options etc., and differs from returning values Is this the only difference between them?

or otherwise, When Should I use testing functions other than equals method?

JavaScript

Advertisement

Answer

assert_frame_equal throws an AssertionError when two DataFrames aren’t equal.

JavaScript

DataFrame.equals simply returns a boolean True/False.

JavaScript

This is also the case for the other functions defined in pd.testing, which are used to develop unit tests for pandas code.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement