Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8617841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:57:50+00:00 2026-06-12T05:57:50+00:00

I am trying to put all elements of rbs into a new array if

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:57:51+00:00Added an answer on June 12, 2026 at 5:57 am

    The and keyword is used by Python to test between two booleans. How can an array be a boolean? If 75% of its items are True, is it True or False? Therefore, numpy refuses to compare the two.

    Therefore, use either c[a & b] or c[np.logical_and(a, b)]. Either approach to combining the a and b arrays – a & b or np.logical_and(a, b) – will produce a boolean array with the same size as the input arrays a and b, which is necessary if the next step is to index into a same-sized array c.

    A list of boolean values cannot be used for indexing instead. NumPy will interpret that as a list of index values (treating True as 1 and False as 0), so the output would contain multiple copies of the first two elements of the array, rather than a masked version.

    Similarly, to choose elements from c where either of the corresponding elements from a or b is true, use c[a | b] or c[np.logical_or(a,b)].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, I am trying to understand why all the elements
I'm trying to put together some jQuery code that will add form elements (input
I am trying to put a XML object into an array but i get
I am trying to make a movie with openCV. I can put all the
I am trying to pull registry info from many servers and put them all
I've been at this all week, trying to put the finishing touches on my
I'm trying put an if statement directly into a select field in rails, with
I'm trying to put some custom list adapters into their own classes to make
I'm trying to process all select elements with a specific data- attribute set. I've
I'm trying to select input elements of all type s except radio and checkbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.