0

I have a dictionary that it's keys are the x,y coordinates and values are any number example:

{(232211,3.7094e+06): [83.77895325168048], (232111,3.7093e+06): [176.90244718253913], (232211,3.7095e+06): [162.89507980124253], (232211,3.7092e+06): [167.29352939350477], (232311,3.7093e+06): [60.92259158728928], (232311,3.7092e+06): [155.54956814535277], (232211,3.7093e+06): [86.61996878573295], (232311,3.7094e+06): [56.810704811835954], (232111,3.7094e+06): [175.5288290699763]}

some x,y coordinates (as key) have more than one value (as value), How can I sum values for each x, y coordinate(as key)?

closed as off-topic by gene, mgri, nmtoken, PolyGeo Jul 9 '17 at 9:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2

It is a pure Python problem with many solutions (Sum of values across all nested dictionaries in python for example)

dicti = {(232211,3.7094e+06): [100], (232111,3.7093e+06): [250, 200], (232211,3.7095e+06): [160,200,300]} 
for i in dicti.values():
    print(i, sum(i))
([100], 100)
([250, 200], 450)
([160, 200, 300], 660)
print sum(sum(i) for i in dicti.values())
1210

Not the answer you're looking for? Browse other questions tagged or ask your own question.