Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. import csv
  2. import sys
  3.  
  4. csv_file = open('salesjan17.csv')
  5.  
  6. csv_reader = csv.reader(csv_file, delimiter=',')
  7.  
  8. # skip the header row
  9. next(csv_reader)
  10.  
  11. order_numbers = []
  12. products_title = []
  13. product_variants = []
  14. price_before_discounts = []
  15. price_after_discount_before_taxes = []
  16. final_prices = []
  17.  
  18.  
  19.  
  20. for row in csv_reader:
  21. sale_ID, date, order_number, transaction_type, sale_type, sales_channel, \
  22. pos_location, billing_country, billing_region, billing_city, \
  23. shipping_country, shipping_region, shipping_city, product_type, \
  24. vendor, title, variant_title, sku, quantity, amount_before_tax, \
  25. line_item_discount, discount, amount_after_discount_before_taxes, \
  26. total_tax, total_amount = row
  27.  
  28. order_number = row[2]
  29. product_title = row[15]
  30. product_variant = row[16]
  31. price_before_discount = row[19]
  32. price_after_discount_before_tax = row[22]
  33. final_price = row[24]
  34.  
  35. order_numbers.append(order_number)
  36. products_title.append(product_title)
  37. product_variants.append(product_variant)
  38. price_before_discounts.append(price_before_discount)
  39. price_after_discount_before_taxes.append(price_after_discount_before_tax)
  40. final_prices.append(final_price)
  41.  
  42. #print(order_numbers, final_prices)
  43.  
  44. print(sale_ID , '-' , title)
  45.  
  46.  
  47.  
  48. csv_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement