0

I have created a group that displays the the total number of items in a sale and the amount of receipts that have total number.

e.g.

1 18853
2 9485

There is another column in the dataframe called total that displays the price of every item in a sale.

Looking at the example output of 1 18853, that indicates that there were 18853 transactions with 1 item. How do I get the SUM price of all 18853 single transaction that contains 1 item, and then do this for every transaction size.

--EDIT-- More context

Here is the code that I used to generate the group

items=supermarket.groupby(['Time', 'Receipt']).size().value_counts()
print(items,'\n')
print('The basket size which is most popular is a basket of 1 items. This is responsible for 18853 seperate transactions.\n\n')

Say there are three seperate items in a transaction for a certain time:

[Time]     [Receipt]     [Total]
12:24:32   124395        5.5
12:24:32   124395        6.3
12:24:32   124395        7.2

I want my output to appear as:

[Time]     [Reciept]     [TotalPrice]
12:24:32   124395        19.0
Keyan H
  • 37
  • 6

0 Answers0