Hi, After simplifying my problem, I can say that I want to get the sum of the product of two culumns:
Say m= [[ 'a', 1], [ 'b', 2],[ 'a', 3]] r={'a':4, 'b':5, 'c':6} What I need is the calculation 1*4 + 2*5 + 3*4 = 4 + 10 + 12 = 26 That is, for each row list in variable 'm' look for its first element in variable 'r' and multiply the value found by the second element in row 'm'. After that, sum all the products. What's an efficient way to do it? I have thousands of these calculations to make on a big data file. Thank you. -- http://mail.python.org/mailman/listinfo/python-list