[Numpy-discussion] Bug (?) converting list to array
Nathaniel Smith
njs at pobox.com
Mon Sep 9 11:35:17 EDT 2013
On 9 Sep 2013 15:50, <josef.pktd at gmail.com> wrote:
>
> On Mon, Sep 9, 2013 at 9:52 AM, Nathaniel Smith <njs at pobox.com> wrote:
> > One list has 6 entries and one has 7, so they can't be aligned into a
single
> > array. Possibly it would be better to raise an error here instead of
> > returning an object array, but that's what's going on.
>
> It did at some point (and I relied on the exception to catch bugs,
> since I'm still using mainly numpy 1.5)
>
> >>> f1 = [[15.207, 15.266, 15.181, 15.189, 15.215, 15.198], [-45, -57,
-62, -70, -72, -73.5, -77]]
> >>> np.array(f1)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: setting an array element with a sequence.
> >>> np.__version__
> '1.5.1'
>
> now we get object arrays (in scipy.stats, and I didn't know what to do
> with them)
>
> I don't remember any discussion on this.
There may not have been any.
Feel free to submit a PR and we can argue about which way is better... (I
also prefer the 1.5 approach personally.)
-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130909/a911df42/attachment.html>
More information about the NumPy-Discussion
mailing list