I have what is effectively a matrix saved as a CSV file. Let's call this matrix 'X'.
What I need to do is take the csv file, read it as a matrix, find it's transpose and then multiply the two together. At the moment I have the following code:
import numpy
import csv
reader = csv.reader(open("votes.csv","rb"), delimiter=",")
text = list(reader)
result = numpy.matrix(text).astype(int)
print result
Which is just supposed to show me the csv file as a matrix of integers but even that is throwing the following error:
result = numpy.matrix(text).astype(int)
ValueError: invalid literal for int() with base 10: ''
Could anyone help me with this?
If it's of any value the csv is simply filled with positive and negative integer values, separated by commas.