[Numpy-discussion] equality of empty arrays
Mon Oct 11 20:06:18 CDT 2010
On Mon, Oct 11, 2010 at 7:58 PM, Vincent Davis <email@example.com>wrote:
> On Mon, Oct 11, 2010 at 6:06 PM, Ian Goodfellow
> <firstname.lastname@example.org> wrote:
> > The reasoning behind this is that == returns an array that specifies
> > whether each element of the two arrays is equal. It's only defined if
> > the arrays are the same shape (or maybe if they can be broadcasted to
> > the same shape).
> >>> m.size==n.size
> >>> m.shape==n.shape
> Not sure about "be broadcasted to the same shape"
> I would kind of expect == to return true, false or some error.
Maybe you are looking for numpy.allclose()?
>>> n = np.array()
>>> m = np.array()
>>> np.allclose(n, m)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion