Skip to content
Advertisement

How can I sum value from array in dictionary with python?

the dictionary data look like this

JavaScript

and the result is sum vl if only br and mnt have same value

JavaScript

Advertisement

Answer

If you can use pandas, try this:

JavaScript

This outputs:

JavaScript

If you really need to, you can turn it back into a list of dictionaries with:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement