Skip to course content
Free course

Data Analysis and Visualization with Python / Module 2

Module 2 activity

Module 2 Activity: Summarize Practice Minutes with NumPy

Estimated active time: 60-75 minutes

Task

Create a NumPy array that represents practice minutes for four learners across five days.

Starter data

practice = [
    [30, 45, 50, 40, 60],
    [10, 20, 15, 0, 25],
    [55, 60, 65, 70, 75],
    [20, 0, 30, 35, 40],
]

Steps

  1. Convert the list to a NumPy array.
  2. Print shape, ndim, size, and dtype.
  3. Select the first learner.
  4. Select day 3 for every learner.
  5. Create a mask for practice minutes greater than or equal to 45.
  6. Add 5 minutes to every value using vectorized operation.
  7. Calculate the mean for each learner.
  8. Calculate the mean for each day.
  9. Use a random seed to simulate 20 quiz scores.
  10. Write three sentences explaining what you learned.

Deliverable

  • NumPy practice notebook or worksheet.
  • Axis explanation note.
  • Simulation output with seed.

Quality bar

The activity is ready when the learner can explain the difference between overall mean, learner mean, and day mean.