I'm writing unittest for a method that returns a dataframe, but, while testing the output using:
self.asserEquals(mock_df, result)
I'm getting ValueError:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Right now I'm comparing properties that serves the purpose now,
self.assertEqual(mock_df.size, result.size)
self.assertEqual(mock_df.col_a.to_list(), result.col_a.to_list())
self.assertEqual(mock_df.col_b.to_list(), result.col_b.to_list())
self.assertEqual(mock_df.col_c.to_list(), result.col_c.to_list())
but curious how do I assert dataframes.
AssertionError
visually the data looks the same and is indexed properly. – Cohin