MolSSI-Education / python_scripting_cms

Python Data and Scripting course for computational chemists
https://molssi-education.github.io/python_scripting_cms
Other
83 stars 33 forks source link

Working with tabular data exercise #10

Closed janash closed 5 years ago

janash commented 5 years ago

Exercise: "Calculate the average of each row of data. You don’t want to include the frame numbers in the average. Make a new list of the average of each row."

I think discarding the frame numbers in the exercise might be confusing for those following along. Since it's in an exercise, I can see it being something people might miss, as they might make new data instead of overwriting the variable, or skip the first column in another way.

For example, this was my solution:

avg_list = []

for row in data:
    avg_list.append(np.mean(row[1:]))

Here, I haven't discarded the frame numbers, so the following code block is different for me.

janash commented 5 years ago

I see that other exercises build on this. The lesson might just need to include explicit instruction to discard the column with the frame number.

janash commented 5 years ago

This has been fixed.