The truth value of an array with more than one element is ambigous when trying to index an array

Posted by user1440194 on Stack Overflow See other posts from Stack Overflow or by user1440194
Published on 2012-09-28T21:14:50Z Indexed on 2012/09/28 21:37 UTC
Read the original article Hit count: 222

Filed under:
|
|

I am trying to put all elements of rbs into a new array if the elements in var(another numpy array) is >=0 and <=.1 . However when I try the following code I get this error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

rbs = [ish[4] for ish in realbooks]
for book in realbooks:
    var -= float(str(book[0]).replace(":", ""))
    bidsred = rbs[(var <= .1) and (var >=0)]

any ideas on what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy