

Summer Lesson 27
Presentation
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Hard
Robert Giordano
Used 1+ times
FREE Resource
14 Slides • 4 Questions
1
Lesson 27
Mean, Median, Mode, and Range
2
Mean, Median, and
Mode
Almost everyone is familiar with the concepts of
mean, median, and mode. These 3 statistical data
pieces are useful in analyzing datasets.
Mean: the average value of the dataset
Median: the middle value of the dataset
Mode: the most repeated value of the dataset
3
Sorting a List
Traditionally, when we perform the analysis on a
dataset, the data needs to be in order. To do this we
sort the dataset. Python actually has a built in function
called sort() that will put the data in a list in order
(ascending).
4
Example:
5
Fill in the Blanks
6
The NumPy and
SciPy Modules
A lot of what we will be doing in this lesson is based
off of the NumPy and SciPy modules. In order to find
the mean and median, we will need to import numpy.
To find the mode we will import stats from scipy.
There are other things in these modules that we
can use in the future as well.
7
Finding the Mean
We use the mean function from the NumPy module to
find the mean and we pass the list in as an argument.
We must either store the returned value in a variable,
or print it to avoid it being lost.
8
Example:
9
Fill in the Blanks
10
Finding the Median
In order to find the median of a list, it first needs to be
sorted. Sorting a list is easy because lists have a built
in method called sort that we can take advantage of.
However, the median method of the NumPy module
also automatically sorts the list as well.
11
Example:
12
Fill in the Blanks
13
Finding the Mode
The mode is the value that is repeated the most often
in the dataset. SciPy has a function that can do it for
us. Otherwise it requires a pretty complicated
algorithm to run through the entire list. The first time
that you import the SciPy module (tested in repl) it will
need a moment to install before the program runs.
We call the mode function that is attached to stats in
the SciPy module
Another way to find the mode would be to import the
statistics module. From there we could use the mode
function.
14
SciPy Mode Example:
This is the mode.
This is the number of times it
occurred.
15
Statistics Module Mode Example:
16
Fill in the Blanks
17
Finding the Range
of a List
The often overlooked stat when dealing with a dataset
is range which essentially is the difference between
the largest and smallest values. Once a dataset is
sorted the range is just the absolute value of the first
element subtracted from the last. We use absolute
value so that it doesn’t matter if the list is in ascending
order (default) or descending order.
18
Example
Lesson 27
Mean, Median, Mode, and Range
Show answer
Auto Play
Slide 1 / 18
SLIDE
Similar Resources on Wayground
14 questions
Sum and Differences of Cubes
Presentation
•
9th - 12th Grade
12 questions
Domain 2 Lesson 1
Presentation
•
9th - 12th Grade
14 questions
Rotations
Presentation
•
9th - 12th Grade
12 questions
Midpoint
Presentation
•
9th - 12th Grade
15 questions
Excel
Presentation
•
9th - 12th Grade
12 questions
AP Computer Science Principles Procedures
Presentation
•
9th - 12th Grade
16 questions
Computer Science Principles Unit 3 Review
Presentation
•
9th - 12th Grade
13 questions
slope
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Review 4
Quiz
•
3rd Grade
11 questions
HSMS - Standard Response Protocol
Quiz
•
6th - 8th Grade
16 questions
1.1-1.2 Quiz Review
Quiz
•
9th - 12th Grade
12 questions
Exponent Expressions
Quiz
•
6th Grade
20 questions
Adding and Subtracting Integers
Quiz
•
6th - 7th Grade
11 questions
Northeast States
Quiz
•
3rd - 4th Grade
10 questions
Characterization
Quiz
•
3rd - 7th Grade
10 questions
Common Denominators
Quiz
•
5th Grade