Lecture 37 – Conclusion, Next Steps

Data 94, Spring 2021

In [1]:
from datascience import *
import numpy as np
Table.interactive_plots()
In [2]:
surveys = Table.read_table('data/hw_times.csv')
In [3]:
surveys
Out[3]:
How much time did you spend on Homework 1? How much time did you spend on Homework 2? How much time did you spend on Homework 3? How much time did you spend on Homework 4? How much time did you spend on Homework 5? How much time did you spend on Homework 6? How much time did you spend on Homework 7? How much time did you spend on Homework 8?
7 7 7 7 5 8 6 4
4 5 5 3 3 5 3 3
4 6 6 6 4 8 3 5
4 5 4 4 3 5 3 3
3 5 5 6 5 6 4 4
5 6 5 5 5 5 5 5
5 6 7 6 6 7 7 7
4 5 4 4 4 5 3 4
6 6 6 4 4 6 3 2
3 3 3 4 4 6 3 3

... (5 rows omitted)

In [5]:
np.mean(surveys)
Out[5]:
How much time did you spend on Homework 1? How much time did you spend on Homework 2? How much time did you spend on Homework 3? How much time did you spend on Homework 4? How much time did you spend on Homework 5? How much time did you spend on Homework 6? How much time did you spend on Homework 7? How much time did you spend on Homework 8?
4.6 5.13333 4.93333 4.73333 4.33333 6.53333 3.86667 4.13333
In [6]:
np.array(np.mean(surveys).row(0))
Out[6]:
array([4.6       , 5.13333333, 4.93333333, 4.73333333, 4.33333333,
       6.53333333, 3.86666667, 4.13333333])
In [7]:
mean_time = Table().with_columns(
    'Homework', np.arange(1, 9),
    'Mean Time Spent', np.array(np.mean(surveys).row(0))
)

mean_time
Out[7]:
Homework Mean Time Spent
1 4.6
2 5.13333
3 4.93333
4 4.73333
5 4.33333
6 6.53333
7 3.86667
8 4.13333
In [9]:
mean_time.plot('Homework')
In [11]:
all_times = mean_time.with_columns(
    'Minimum Time Spent', np.array(np.min(surveys).row(0)),
    'Maximum Time Spent', np.array(np.max(surveys).row(0))
)

all_times
Out[11]:
Homework Mean Time Spent Minimum Time Spent Maximum Time Spent
1 4.6 3 8
2 5.13333 2 8
3 4.93333 3 8
4 4.73333 3 8
5 4.33333 3 8
6 6.53333 5 8
7 3.86667 2 7
8 4.13333 2 8
In [12]:
all_times.plot('Homework', 
               yaxis_title = 'Hours',
               title = 'Reported Time Spent Per Homework')