Statistics in NumPy
Learn how to analyze different statistical distributions using NumPy.
StartKey Concepts
Review core concepts you need to learn to master this subject
NumPy’s Mean and Axis
Conditions in Numpy.mean()
NumPy Percentile Function
NumPy’s Percentile and Quartiles
NumPy’s Sort Function
Definition of Percentile
Datasets and their Histograms
Normal Distribution using Python Numpy module
NumPy’s Mean and Axis
NumPy’s Mean and Axis
We will use the following 2-dimensional array for this example:
```
py
ring_toss = np.array([[1, 0, 0],
[0, 0, 1],
[1, 0, 1]])
```
The code below will calculate the average of each row.
```py
np.mean(ring_toss, axis=1)
# Output: array([ 0.33333333, 0.33333333, 0.66666667])
```
In a two-dimensional array, you may want the mean of just the rows or just the columns. In Python, the NumPy .mean()
function can be used to find these values. To find the average of all rows, set the axis parameter to 1. To find the average of all columns, set the axis parameter to 0.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory