I have a CSV file where there is an array in each row. I would like to convert the row contents to columns i.e. a Matrix at the end (since I have multiple rows). I can do it using a for loop and csv.reader - but it's quite slow. So, I had an idea that Pandas would be faster, and that I could do the conversion without the need for a loop. I read the file and get a Datframe type of Size (200,1) - where each row contains 700 floats that are comma separated, e.g. [0.4, 0.5, 0.3, ....]
If I do a .value on the output I just get it converted to an Object Type - still not usable...
I just can't figure out how to convert this data into a Matrix...
Am I looking in the wrong direction here?
ranges = pd.read_csv(name,usecols=['ranges'])
What does work is this:
X = open(name)
csv_X=csv.reader(X)
ranges = []next(csv_X)#jump over the first row in the csv
for row in csv_X:
ranges.append(ast.literal_eval(row[14]))
X.close()
But that is just really slow. So, my idea about using Pandas is to speed this up.