NumPy - Statistics

Thomas J. Kennedy

Contents:

1 Overview

NumPy provides a number of operations that are useful for statistics, including min, max, and mean. The NumPy implementations are more performant that the vanilla Python equivalents.

2 An Example Problem

Suppose we need to compute some grade statistics for the following data.

Name Homework 1 Homework 2 Exam 1 Exam 2
John 100 98 100 90
Tom 100 0 70 90
Bob 100 70 90 80

The first step is to convert the table into…

3 NumPy Operations and Axis

NumPy provides a number of statistics operations that can be applied by axis. For a two-dimensional ndarray there are two choices:

Take note of the axis keyword argument. For a 2-D ndarray a zero (0) indicates analysis by column and a one (1) indicates analysis by row.