Commit f007e341 authored by MichaelAng's avatar MichaelAng

[ban265] use supermarket csv

parent f1a4dedd
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
import csv import csv
target_record = 2_000_000 target_record = 15
with open("record.csv", "r") as file: with open("supermarket.csv", "r") as file:
reader = csv.DictReader(file) reader = csv.DictReader(file)
for i, row in enumerate(reader): for i, row in enumerate(reader):
if i == target_record: if i == target_record:
print("Date: ", row.get("Date")) print("Date: ", row.get("Date"))
print("Transaction Number: ", row.get("Transaction Number")) print("Transaction Number: ", row.get("Transaction Number"))
print("UPC Number: ", row.get("UPC Number"))
print("Customer Account: ", row.get("Customer Account")) print("Customer Account: ", row.get("Customer Account"))
print("Sale Price: ", row.get("Sale Price")) print("Sale Price: ", row.get("Sale Price"))
Date,Transaction Number,UPC Number,Product Name,Customer Account,Qty,Regular Price,Sale Price,Discount
2016-04-25 13:34:35.287,T001,P001,EGGPLANT,C001,1.25,1.9900000000000,1.99,0.00
2016-04-25 13:34:35.297,T001,P001,EGGPLANT,C001,1.26,1.9900000000000,1.99,0.00
2016-04-25 13:34:35.307,T001,P002,MILK,C001,1,3.9900000000000,3.99,0.00
2016-04-26 13:34:35.287,T002,P001,EGGPLANT,C002,1.25,1.9900000000000,1.99,0.00
2016-04-26 13:34:35.297,T002,P003,BREAD,C002,2,0.9900000000000,0.99,0.00
2016-04-26 13:34:35.307,T002,P002,MILK,C002,1,3.9900000000000,3.99,0.00
2016-05-01 13:34:35.287,T003,P001,EGGPLANT,C002,1.25,1.9900000000000,1.99,0.00
2016-05-01 13:34:35.297,T003,P003,BREAD,C002,3,0.9900000000000,0.99,0.00
2016-05-09 13:34:35.287,T004,P001,EGGPLANT,C002,1.25,1.9900000000000,1.99,0.00
2016-05-09 13:34:35.297,T004,P003,BREAD,C002,3,0.9900000000000,0.99,0.00
2016-05-10 13:34:35.297,T005,P001,EGGPLANT,C001,1.26,1.9900000000000,1.99,0.00
2016-05-10 13:34:35.307,T005,P002,MILK,C001,1,3.9900000000000,3.99,0.00
2016-05-19 13:34:35.287,T006,P001,EGGPLANT,C002,1.25,1.9900000000000,1.99,0.00
2016-05-19 13:34:35.297,T006,P003,BREAD,C002,3,0.9900000000000,0.99,0.00
2016-05-26 13:34:35.287,T007,P001,EGGPLANT,C001,1.25,1.9900000000000,1.99,0.00
2016-05-26 13:34:35.297,T007,P001,EGGPLANT,C001,1.26,1.9900000000000,1.99,0.00
2016-05-26 13:34:35.307,T007,P002,MILK,C001,1,3.9900000000000,3.99,0.00
2016-05-29 13:34:35.287,T008,P001,EGGPLANT,C002,1.25,1.9900000000000,1.99,0.00
2016-05-29 13:34:35.297,T008,P003,BREAD,C002,3,0.9900000000000,0.99,0.00
2016-06-12 13:34:35.297,T009,P003,BREAD,C003,3,0.9900000000000,0.99,0.00
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment