e): 1 #In order to find the total amount of each row we need to multiply the Quantity and the Unitprice and create a new #column c 2 3 Datal['Values '] = Data1['Quantity'] * Data1. ['UnitPrice'] %3D 4...


What  is the python code in getting the average purchase amount


Company likes to find out overall average purchase-amount among all transactions [ one transaction indicates one invoice number].


Expected output: Average purchase among all transactions = 44.39


e):<br>1 #In order to find the total amount of each row we need to multiply the Quantity and the Unitprice and create a new #column c<br>2<br>3 Datal['Values '] = Data1['Quantity'] * Data1. ['UnitPrice']<br>%3D<br>4<br>5<br>6 # this Line is used for finding the average or mean for all the data in that column<br>7 average_df = Data1['Values'].mean()<br>10 # print the average_df<br>11 print(average_df)<br>12<br>13<br>File ", line 3 Data1['Values'] = Datal['Quantity'] * Data1.['UnitPrice'] SyntaxError: invalid syntax "/>
Extracted text: e): 1 #In order to find the total amount of each row we need to multiply the Quantity and the Unitprice and create a new #column c 2 3 Datal['Values '] = Data1['Quantity'] * Data1. ['UnitPrice'] %3D 4 5 6 # this Line is used for finding the average or mean for all the data in that column 7 average_df = Data1['Values'].mean() 10 # print the average_df 11 print(average_df) 12 13 File "kipython-input-40-3cf5f94ae26a>", line 3 Data1['Values'] = Datal['Quantity'] * Data1.['UnitPrice'] SyntaxError: invalid syntax
InvoiceNo StockCode<br>Description Quantity<br>InvoiceDate UnitPrice CustomerlD<br>Country<br>536365<br>85123A<br>WHITE HANGING HEART T-LIGHT HOLDER<br>01/12/2010 8:26<br>2.55<br>17850.0 United Kingdom<br>536365<br>71053<br>WHITE METAL LANTERN<br>01/12/2010 8:26<br>3.39<br>17850.0 United Kingdom<br>2<br>536365<br>84406B<br>CREAM CUPID HEARTS COAT HANGER<br>8<br>01/12/2010 8:28<br>2.75<br>17850.0 United Kingdom<br>3<br>536365<br>84029G KNITTED UNION FLAG HOT WATER BOTTLE<br>01/12/2010 8:28<br>3.39<br>17850.0 United Kingdom<br>4<br>536365<br>84029E<br>RED WOOLLY HOTTIE WHITE HEART.<br>01/12/2010 8:26<br>3.39<br>17850.0 United Kingdom<br>195<br>536388<br>22469<br>HEART OF WICKER SMALL<br>12<br>01/12/2010 9:59<br>1.65<br>18250.0 United Kingdom<br>196<br>538388<br>22242<br>5 HOOK HANGER MAGIC TOADSTOOL<br>1.85<br>18250.0 United Kingdom<br>12<br>01/12/2010 9:59<br>197<br>536389<br>22941<br>CHRISTMAS LIGHTS 10 REINDEER<br>6 01/12/2010 10:03<br>8.50<br>12431.0<br>Australia<br>198<br>536389<br>21622<br>VINTAGE UNION JACK CUSHION COVER<br>8 01/12/2010 10:03<br>4.95<br>12431.0<br>Australia<br>199<br>536389<br>21791<br>VINTAGE HEADS AND TAILS CARD GAME<br>12 01/12/2010 10:03<br>1.25<br>12431.0<br>Australia<br>200 rows x 8 columns<br>

Extracted text: InvoiceNo StockCode Description Quantity InvoiceDate UnitPrice CustomerlD Country 536365 85123A WHITE HANGING HEART T-LIGHT HOLDER 01/12/2010 8:26 2.55 17850.0 United Kingdom 536365 71053 WHITE METAL LANTERN 01/12/2010 8:26 3.39 17850.0 United Kingdom 2 536365 84406B CREAM CUPID HEARTS COAT HANGER 8 01/12/2010 8:28 2.75 17850.0 United Kingdom 3 536365 84029G KNITTED UNION FLAG HOT WATER BOTTLE 01/12/2010 8:28 3.39 17850.0 United Kingdom 4 536365 84029E RED WOOLLY HOTTIE WHITE HEART. 01/12/2010 8:26 3.39 17850.0 United Kingdom 195 536388 22469 HEART OF WICKER SMALL 12 01/12/2010 9:59 1.65 18250.0 United Kingdom 196 538388 22242 5 HOOK HANGER MAGIC TOADSTOOL 1.85 18250.0 United Kingdom 12 01/12/2010 9:59 197 536389 22941 CHRISTMAS LIGHTS 10 REINDEER 6 01/12/2010 10:03 8.50 12431.0 Australia 198 536389 21622 VINTAGE UNION JACK CUSHION COVER 8 01/12/2010 10:03 4.95 12431.0 Australia 199 536389 21791 VINTAGE HEADS AND TAILS CARD GAME 12 01/12/2010 10:03 1.25 12431.0 Australia 200 rows x 8 columns
Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here