Created
September 30, 2015 09:20
-
-
Save skaae/960d2ea96a533bb95ed3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize column sums | |
column_sums = [0., 0.] | |
# Iterate over all rows | |
for row in row_list: | |
# For each of the two column values, add to the corresponding sum | |
column_sums[0] += row[0] | |
column_sums[1] += row[1] | |
# Calculate the average by dividing by the length | |
column_avgs = [column_sums[0]/float(len(row_list)), | |
column_sums[1]/float(len(row_list))] | |
print "Column averages: ", column_avgs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment