from datascience import *
import numpy as np
Table.interactive_plots()
surveys = Table.read_table('data/hw_times.csv')
surveys
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)
np.mean(surveys)
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 |
np.array(np.mean(surveys).row(0))
array([4.6 , 5.13333333, 4.93333333, 4.73333333, 4.33333333, 6.53333333, 3.86666667, 4.13333333])
mean_time = Table().with_columns(
'Homework', np.arange(1, 9),
'Mean Time Spent', np.array(np.mean(surveys).row(0))
)
mean_time
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 |
mean_time.plot('Homework')