[Numpy-discussion] howto check arrays for equal (numpy 1.0b, array_equal is absent)? & best way to copy?
Bill Baxter
wbaxter at gmail.com
Mon May 7 04:22:37 EDT 2007
On 5/7/07, dmitrey <openopt at ukr.net> wrote:
> hi all,
> I have some troubles with Python2.5+matplotlib, so now I'm using
> Python2.4.3. I failed to compile both numpy1.0.1 and 1.0.2
> (Mandrake2007) so currently I'm using 1.0b.
> Howto check if numpy.array instances x and y are equal? (i.e. all
> elements are same)
numpy.all(A==B) should do it. But if you're dealing with floating
point, then numpy.allclose(A,B) is probably a better choice.
>
> Please answer one more question - what is the best (fastest) way to
> create copy of numpy.array instance?
B = A.copy()
Unless you don't mind the "copy" referring to the same memory, and then just
B = A
--bb
More information about the NumPy-Discussion
mailing list