#In order to find the totol amount of each row we need to multiply the Quantity and Datal[ 'values '] = Data1['Quantity'] * Data1. ['unitprice'] # this Line is used for finding the average or mean for all the data in that column average_df = Datal['values'].mean() # print the average_df print(average_df)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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):
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
Transcribed Image 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
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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Binary Search Algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education