Skip to content

assert_almost_equal / equals should allow access to np.allclose #9457

Closed
@rockg

Description

@rockg

I am testing the equivalence of two large DataFrames (9084x367). The two are the same up to 1x10-13 but when np.array_equal fails there is a much slower code path (comparing these two frames takes upwards of 20 seconds). If I'm not mistaken, if the arrays aren't equivalent it does a more complicated version of np.allclose. I think a good intermediate step would be to check for array equivalence and then as a the second step call np.allclose--or maybe just do this on the outset. If that fails, which it will if there are any NaNs or if the tolerance is not met, then it will use the current logic. Or we could use np.isclose to consider NaNs as equivalent.

https://github.com/pydata/pandas/blob/master/pandas/src/testing.pyx#L85

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions