adding data from different rows in a csv belonging to a common variable
<p>this is my csv excel file information:</p>

<pre><code>  Receipt merchant    Address      Date    Time    Total price
    25007   A      ABC pte ltd   3/7/2016   10:40   12.30
    25008   A      ABC ptd ltd   3/7/2016   11.30   6.70
    25009   B      CCC ptd ltd   4/7/2016   07.35   23.40
    25010   A      ABC pte ltd   4/7/2016   12:40   9.90
</code></pre>

<p>how is it possible to add the 'Total Price' of each line together only if they belong to the same 'merchant', 'date' and 'time' then grouping them together in a list or dict, example: {['A','3/7/2016', '19.0'], ['A',4/7/2016, '9.90'],..}
My previous code does what i wanted except that i lack the code to count the total price for each same date and merchant. </p>

<pre><code>from collections import defaultdict
from csv import reader
with open("assignment_info.csv") as f:
    next(f) 
    group_dict = defaultdict(list)
    for rec, name, _, dte, time, price in reader(f):
        group_dict[name, dte].extend(time)
    for v in group_dict.values():v.sort()    

from  pprint import pprint as pp
print 'Sales tracker:'
pp(dict(group_dict))
</code></pre>

<pre><code>import pandas as pd

df = pd.read_csv('assignment_info.csv')
df = df.groupby(['merchant', 'Date', 'Time']).sum().reset_index()
df
</code></pre>

python csv pandas design-patterns group