Equal arrays

The assert_array_equal() function raises an exception if two arrays are not equal. The shapes of the arrays have to be equal and the elements of each array must be equal. NaNs are allowed in the arrays. Alternatively, arrays can be compared with the array_allclose() function. This function has the parameters absolute tolerance (atol) and relative tolerance (rtol). For two arrays a and b, these parameters satisfy the following equation:

|a - b| <= (atol + rtol * |b|)

Get NumPy : Beginner's Guide - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.