The (hours,score) pairs for 3 students are (2,55),(4,70),(6,85). Time is in h.
Procedure
Make each sample a Dictionary and group them in a List.
Create separate Lists containing only hours and only scores, and calculate their means.
Results to retain
A 3-row data table and per-field means.
Items to record and points to check
Samples
Time [h]
Score
Data type
Points to check
Did you avoid confusing numbers with strings?
2. Missing Samples
Starting conditions
The fourth sample has hours=3, score=None. Distinguish missing samples when calculating the mean.
Procedure
Add {"hours":3,"score":None} to records to create records2. Extract hours and score by field.
Calculate each field's mean, excluding only values that are None. In two rows, record field name, original value count, count used for the mean, and mean.
Compare the means before and after the addition, and explain whether a missing score is a reason to exclude its hours value as well.
Results to retain
A table of per-field value counts and means before and after adding data.
Items to record and points to check
Field name
Total number of values
Number of values used for the mean
Means before and after the addition
Points to check
Did you distinguish the number of values used for each field's mean?
3. Making Decisions with Prepared Data
Starting conditions
Organize the new device's records [(0,18),(1,19),(2,None)] using the same field names.
Procedure
Create a list of dictionaries from the new records, mapping the first value in each pair to the previous activity's input field and the second to its measurement field. Preserve None unchanged.
Calculate the count and mean of valid measurements, and plot inputs against measurements. Change one missing-value handling rule and calculate the same results again. For example, you can compare excluding missing values with replacing them with 0.
Record the two selected handling rules, valid-value counts, and means. Relate these results to why you need to understand what missing values mean in the original data.
Results to retain
A scatter plot of the new data and a table of counts and means under each missing-value handling rule.
For the new device data, the first value is an input coordinate and the second is a measurement; physical units are not specified. Keep hours and score as keys for reusing the data structure, and label the plot axes 'Input coordinate' and 'Measurement'. Record the original observation count separately from the count used to calculate the mean after handling missing values.
Items to record and points to check
Two fields in the record
Missing-value handling rule
Original observation count, count used in calculation, and mean
Scatter plots and interpretation
Points to check
Did you distinguish originally missing values from values after processing?