Python sum values of list of dictionaries if two other key value pairs match
<p>I have a list of dictionaries of the following form:</p>

<pre><code>lst = [{"Name":'Nick','Hour':0,'Value':2.75},
       {"Name":'Sam','Hour':1,'Value':7.0},
       {"Name":'Nick','Hour':0,'Value':2.21},
       {'Name':'Val',"Hour":1,'Value':10.1},
       {'Name':'Nick','Hour':1,'Value':2.1},  
       {'Name':'Val',"Hour":1,'Value':11},]  
</code></pre>

<p>I want to be able to sum all values for a name for a particular hour, e.g. if <code>Name == Nick and Hour == 0</code>, I want value to give me the sum of all values meeting the condition. <code>2.75 + 2.21</code>, according to the piece above.  </p>

<p>I have already tried the following but it doesn't help me out with both conditions.  </p>

<pre><code>finalList = collections.defaultdict(float)
for info in lst:
    finalList[info['Name']] += info['Value']
finalList = [{'Name': c, 'Value': finalList[c]} for c in finalList]  
</code></pre>

<p>This sums up all the values for a particular <code>Name</code>, not checking if the <code>Hour</code> was the same. How can I incorporate that condition into my code as well?  </p>

<p>My expected output : </p>

<pre><code>finalList = [{"Name":'Nick','Hour':0,'Value':4.96},
       {"Name":'Sam','Hour':1,'Value':7.0},
       {'Name':'Val',"Hour":1,'Value':21.1},
       {'Name':'Nick','Hour':1,'Value':2.1}...]  
</code></pre>