<filename>introduction/numpy/python/4.boolean_array.py<gh_stars>1-10
# height and weight are available as a regular lists
height = [43, 53, 65, 54, 62, 99]

# Import numpy
import numpy as np

# Calculate the BMI: bmi
np_height_m = np.array(height) * 0.0254
np_weight_kg = np.array(weight) * 0.453592
bmi = np_weight_kg / np_height_m ** 2

# Create the light array
light = bmi < 21

# Print out light
print(light)

# Print out BMIs of all baseball players whose BMI is below 21 | Subsetting
print(bmi[light])

<filename>introduction/numpy/python/4.boolean_array.py<gh_stars>1-10
# height and weight are available as a regular lists
height = [43, 53, 65, 54, 62, 99]

# Import numpy
import numpy as np

# Calculate the BMI: bmi
np_height_m = np.array(height) * 0.0254
np_weight_kg = np.array(weight) * 0.453592
bmi = np_weight_kg / np_height_m ** 2

# Create the light array
light = bmi < 21

# Print out light
print(light)

# Print out BMIs of all baseball players whose BMI is below 21 | Subsetting
print(bmi[light])

# height and weight are available as a regular lists # Import numpy # Calculate the BMI: bmi # Create the light array # Print out light # Print out BMIs of all baseball players whose BMI is below 21 | Subsetting