Get startedGet started for free

Average versus median

You now know how to use numpy functions to get a better feeling for your data.

The baseball data is available as a 2D numpy array with 3 columns (height, weight, age) and 1015 rows. The name of this numpy array is np_baseball. After restructuring the data, however, you notice that some height values are abnormally high. Follow the instructions and discover which summary statistic is best suited if you're dealing with so-called outliers. np_baseball is available.

This exercise is part of the course

Introduction to Python

View Course

Exercise instructions

  • Create numpy array np_height_in that is equal to first column of np_baseball.
  • Print out the mean of np_height_in.
  • Print out the median of np_height_in.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

import numpy as np

# Create np_height_in from np_baseball


# Print out the mean of np_height_in


# Print out the median of np_height_in
Edit and Run Code