UPDATE: To compare "close" and not "equal" use "check_exact=False" in the call to "assert_frame_equal" as detailed here: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.testing.assert_frame_equal.html.
Original question: A Pandas dataframe contains N columns of floats.
I want to check whether the elements in each possible pair of columns are equal (so check if all elements in column i are close, within some tolerance I mean, to all elements in column j).
I could iterate and use np.allclose(...)
, but I wonder if there is a better (read: built-in) way of doing this in Pandas, ideally something where I can use the column labels?
I am thinking: df.allclose(['a', 'b', 'c'])
kind of thing...