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 8788143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:05:39+00:00 2026-06-13T22:05:39+00:00

Say I have the following setup: x=np.array(range(0,100)) y=x**0.5 z=x**2 How could I get all

  • 0

Say I have the following setup:

x=np.array(range(0,100))
y=x**0.5
z=x**2

How could I get all the values of y between 4 and 8, and create a new array that had a row for those y values, but also a row for the corresponding z values?

i.e. 25 in x has a y value of 5 which is between 4 and 8, I’d like this value, but I’d also like the z value of 625 in the row below.

The math equations are just an example, the forumals could be anything including bessel functions.

Thanks

  • 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-13T22:05:43+00:00Added an answer on June 13, 2026 at 10:05 pm
    >>> np.vstack((y, z))[:,(y >= 4) & (y <= 8)]
    array([[  4.00000000e+00,   4.12310563e+00,   4.24264069e+00,
              4.35889894e+00,   4.47213595e+00,   4.58257569e+00,
              4.69041576e+00,   4.79583152e+00,   4.89897949e+00,
              ...
              7.81024968e+00,   7.87400787e+00,   7.93725393e+00,
              8.00000000e+00],
           [  2.56000000e+02,   2.89000000e+02,   3.24000000e+02,
              3.61000000e+02,   4.00000000e+02,   4.41000000e+02,
              ...
              3.72100000e+03,   3.84400000e+03,   3.96900000e+03,
              4.09600000e+03]])
    

    Here, vstack() creates a matrix with two rows, one containing y and one containing z. The [...] then eliminates those columns that don’t satisfy the criterion.

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

Sidebar

Related Questions

I have the following setup. Class, say, Car that has a CarPart (belongsTo=[car:Car]). When
Let's say you have the following setup. You have a server with the basepath
Say I have the following data IEnumerable<IEnumerable<int>> items = new IEnumerable<int>[] { new int[]
Let's say I have the following tables setup in SQL Server (2008) Is there
Let's say we have the following setup: public class ClassA { public event EventHandler
Say I have the following: public interface ISession { T Get<T>(dynamic filter); } }
we have the following setup: We have a array of objects with a string
Say I have an array of strings I am displaying the following data in
Let's say I have the following setup class A { B foo(); } class
Say I have the following setup: Page1.html Includes master.css, page1.css and page1.js Page2.html Includes

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.