Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. __author__ = 'structur'
  2.  
  3. #!/usr/bin/env python
  4. """
  5. Makes a bar graph out of imported lists of stock tuples
  6. """
  7. # import numpy as np
  8. # import matplotlib.pyplot as plt
  9. from mining import *
  10. import json
  11. import datetime
  12.  
  13. with open('/Users/curtismccord/PycharmProjects/assignment_3/data/GOOG.json', 'r') as stock_reader:
  14.     stock_json = stock_reader.read
  15.     stock_results = json.loads(stock_json)
  16.  
  17. # Import jsons and functions OR function results OR the classes...
  18.  
  19.  
  20. six_best_months = mining.six_best_months(stock_results)
  21. six_worst_months = mining.six_worst_months(stock_results)
  22.  
  23. six_best_months = [('2007/12', 693.76), ('2007/11', 676.55), ('2007/10', 637.38), ('2008/01', 599.42),
  24.                    ('2008/05', 576.29), ('2008/06', 555.34)]
  25.  
  26. six_worst_months = [('2004/08', 104.66), ('2004/09', 116.38), ('2004/10', 164.52), ('2004/11', 177.09),
  27.                     ('2004/12', 181.01), ('2005/03', 181.18)]
  28.  
  29. best_stock_prices = []
  30. best_stock_dates = []
  31. worst_stock_prices = []
  32. worst_stock_dates = []
  33.  
  34.  
  35. def sort_best_results(stock_results):
  36.     for datum in stock_results:
  37.         best_stock_dates.append(datum[0])
  38.         best_stock_prices.append(datum[1])
  39.     print(best_stock_prices)
  40.     print(best_stock_dates)
  41.  
  42. def sort_worst_results(stock_results):
  43.     for datum in stock_results:
  44.         worst_stock_dates.append(datum[0])
  45.         worst_stock_prices.append(datum[1])
  46.     print(worst_stock_prices)
  47.     print(worst_stock_dates)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement