lundi 25 juillet 2016

Python sum 2D list column coincident

I'm looking for the most efficient method to do the following calculation:

I have three matrix, like this:

[[Brand1, operationCost], [Brand2, operationCost],...]

[[Brand1, maintenanceCost],[Brand2, maintenanceCost]...]

[[Brand1, replacementCost],[Brand2, replacementCost]...]

and I need to calculate the total cost, operation+maintenance+replacement, of each of the brands. It is posible that same of the marks are not in all the matrix. And obtain another matrix like this:

[[Brand1, totalCost],[Brand2, totalCost]...]    

Aucun commentaire:

Enregistrer un commentaire