Question: To subset both regular Python lists and numpy arrays, you can use square brackets: x = [ 4 , 9 , 6 , 3 ,
To subset both regular Python lists and numpy arrays, you can use square brackets:
x
x
import numpy as np
y nparrayx
y
For numpy specifically, you can also use boolean numpy arrays:
high y
yhigh
The code that calculates the BMI of all baseball players is already included. Follow the instructions and reveal interesting things from the data! heightin and weightlb are available as regular lists.
Instructions
XP
Create a boolean numpy array: the element of the array should be True if the corresponding baseball player's BMI is below You can use the operator for this. Name the array light.
Print the array light.
Print out a numpy array with the BMIs of all baseball players whose BMI is below Use light inside square brackets to do a selection on the bmi array
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
