# initiate a few variables
i = 0
x = []
y = []

# read csv file and store data in arrays x and y
import csv
with open('prob12-1.csv', 'rb') as csvfile:
   reader = csv.reader(csvfile)
   for row in reader:
       i += 1
       print i
       xy = row
       x.append(int(xy[0]))
       y.append(int(xy[1]))
       print x
       print y

print x
print y

# now use arrays x and y to run linear regression
import scipy.stats as stats

lr = stats.linregress
slope, intercept, rvalue, pvalue, stderr = lr(x,y)

# print results to screen
print ("slope, intercept, rvalue, pvalue, stderr")
print slope
print intercept
print rvalue
print pvalue
print stderr

print ("Boom!")