#!/usr/bin/python
import os
import string
import math
import re

with open("his.csv") as f:
    content = f.read().splitlines()
print content[0]     ###
print content[len(content)-1]    ###

print "len(content): " ,  len(content)
DATES = []
CLOSE = []
VOLUME = []
OPEN = []
HIGH = []
LOW = []


for i in range(1, len(content)): 
  #content1 = content[i-1].split(",")
  content1 = content[i-1].replace('"', '').split(",")
  DATES.append(content1[0])
  CLOSE.append(float(content1[1]))
  VOLUME.append(content1[2])
  OPEN.append(content1[3])
  HIGH.append(content1[4])
  LOW.append(content1[5])


print "DATES: ", DATES    
print "CLOSE: ", CLOSE
print "VOLUME: ", VOLUME
print "OPEN: ", OPEN
print "HIGH: ", HIGH
print "LOW: ", LOW

SUM_CLOSE = 0
len4a = len(CLOSE)
#print "len4a: ", len4a
#close_ = [1, 2, 3, 4, 5]
#print math.fsum(close_)/len(close_)  #
print "Minimum Closing: ", min(CLOSE)
print "Average Closing: ", math.fsum(CLOSE)/len(CLOSE)  
print "Max Closing    : ", max(CLOSE)



f.close()
