When constructing an numpy object array from a list of numpy arrays,
one observes the following behaviour
import numpy as N
a=[N.zeros([2,2], N.object_), N.zeros([2,2], N.object_)]
b=N.array(a, N.object_)
print b.shape
(2, 2, 2)
a=[N.zeros([2,2], N.object_), N.zeros([2,1], N.object_)]
Garnet Chan wrote:
When constructing an numpy object array from a list of numpy arrays,
one observes the following behaviour
import numpy as N
a=[N.zeros([2,2], N.object_), N.zeros([2,2], N.object_)]
b=N.array(a, N.object_)
print b.shape
(2, 2, 2)
a=[N.zeros([2,2], N.object_),
Apologies if I've missed the discussion of this, but I was recently
surprised by the following behavior (in svn trunk 4673). The following
code runs without triggering the assertion.
import numpy as np
print np.__version__
a=np.int32(42)
b=np.array([],dtype=np.int32)
assert np.allclose(a,b)
Is
Andrew Straw wrote:
Apologies if I've missed the discussion of this, but I was recently
surprised by the following behavior (in svn trunk 4673). The following
code runs without triggering the assertion.
import numpy as np
print np.__version__
a=np.int32(42)
b=np.array([],dtype=np.int32)
On Jan 3, 2008 1:06 PM, Robert Kern [EMAIL PROTECTED] wrote:
Andrew Straw wrote:
Apologies if I've missed the discussion of this, but I was recently
surprised by the following behavior (in svn trunk 4673). The following
code runs without triggering the assertion.
import numpy as np
Thanks - that's clear I guess, although I still think that it might be
less confusing if numpy did not try to be clever!
On 1/3/08, Christopher Barker [EMAIL PROTECTED] wrote:
Garnet Chan wrote:
When constructing an numpy object array from a list of numpy arrays,
one observes the following
I am experimenting with the new MaskedArray (from
http://svn.scipy.org/svn/numpy/branches/maskedarray) as a
replacement for my own home-brewed masked data handling mechanisms. In
what I have built myself, I often work with record arrays that have a
single mask for the whole record (no fieldmask).
Working with the new MaskedArray, I noticed the following differences
with numpy.array behavior:
masked_array([1, 2, 3], mask=True).min()
2147483647
array([]).min()
Traceback (most recent call last):
File stdin, line 1, in module
ValueError: zero-size array to ufunc.reduce without identity
On Thu, 3 Jan 2008, Charles R Harris apparently wrote:
Isn't it trivially true that all elements of an empty
array are close to any number?
Sure, but might not one expect a ValueError due to
shape mismatch? (Doesn't allclose usually use
normal broadcasting rules?)
Cheers,
Alan Isaac
Hi,
import numpy as np
print np.__version__
a=np.int32(42)
b=np.array([],dtype=np.int32)
assert np.allclose(a,b)
Is this expected behavior of numpy or is this a bug I should report?
Bug, I think.
I think this bug - which may be mine - follows from this line in allclose:
On Thu, 3 Jan 2008, Charles R Harris apparently wrote:
Isn't it trivially true that all elements of an empty
array are close to any number?
On Thu, 3 Jan 2008, Alan G Isaac apparently wrote:
Sure, but might not one expect a ValueError due to
shape mismatch? (Doesn't allclose usually use
Just to ask - is there a reason why this:
In [39]: all([])
Out[39]: True
is the case?
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
On Jan 3, 2008 2:37 PM, Matthew Brett [EMAIL PROTECTED] wrote:
Just to ask - is there a reason why this:
In [39]: all([])
Out[39]: True
is the case?
Because it's True. Anything is true about the elements of an empty set,
because there aren't any. In this case, all asks if all elements
So, currently we have all and allclose giving the same answer:
In [19]: a = array([])
In [20]: b = array([1])
In [21]: all(a == b)
Out[21]: True
In [22]: allclose(a, b)
Out[22]: True
Would we want the answers to be different?
___
Numpy-discussion
Matthew Brett wrote:
So, currently we have all and allclose giving the same answer:
In [19]: a = array([])
In [20]: b = array([1])
In [21]: all(a == b)
Out[21]: True
In [22]: allclose(a, b)
Out[22]: True
Would we want the answers to be different?
No. I wasn't thinking correctly,
Stefan van der Walt wrote:
Hi all,
I read about Titus Brown's Figleaf code coverage tool [1] on the
Planet SciPy aggregator [2]. The results of running figleaf on the
numpy test-suite [3] covers Python code only.
What the best way of discovering the C and C++ code coverage as well?
I've
So, currently we have all and allclose giving the same answer:
In [19]: a = array([])
In [20]: b = array([1])
In [21]: all(a == b)
Out[21]: True
In [22]: allclose(a, b)
Out[22]: True
Would we want the answers to be different?
No. I wasn't thinking correctly, previously.
Hi all,
I can't figure out why this is happening ... I just recently
recompiled numpy/scipy from svn just for the heck of it.
Anyway, somewhere in my codebase (for a long time now) I'm doing:
from numpy.matlib import *
Now, when I try to use this code, or just type that in the
interpreter,
Matthew Brett wrote:
So, currently we have all and allclose giving the same answer:
In [19]: a = array([])
In [20]: b = array([1])
In [21]: all(a == b)
Out[21]: True
In [22]: allclose(a, b)
Out[22]: True
Would we want the answers to be different?
No. I wasn't thinking
Hi
Okay, here's a weird one. In Fortran you can specify the upper/lower
bounds of an array
e.g. REAL A(3:7)
What would be the best way to translate this to a Numpy array? I would
like to do something like
A=numpy.zeros(shape=(5,))
and have the expression A[3] actually return A[0].
Or
20 matches
Mail list logo