[Numpy-discussion] List of arrays failing index(), remove() etc

mfm24 murfitt at gmail.com
Wed May 7 20:14:08 EDT 2014

I'm having a problem I haven't seen elsewhere (and apologies if it has been
answered before).
I see the following behavior (copied verbatim from a python session):
Python 2.7.4 (default, Apr  6 2013, 19:55:15) [MSC v.1500 64 bit (AMD64)] on
win32Type "help", "copyright", "credits" or "license" for more
information.>>> import numpy as np>>> x=[[np.zeros(10)] for i in
range(10)]>>> x.index(x[0])0>>> x.index(x[1])Traceback (most recent call
last):  File "", line 1, in ValueError: The truth value of an array with
more than one element is ambiguous. Use a.any() or a.all()>>>
x[1].append(np.zeros(10))>>> x.index(x[1])1
Any ideas why I see a ValueError when trying to find the index of a list
containing a single ndarray?

View this message in context: http://numpy-discussion.10968.n7.nabble.com/List-of-arrays-failing-index-remove-etc-tp37544.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140507/a1c182de/attachment.html>

More information about the NumPy-Discussion mailing list