I have a 3.3gb file containing one long line. The values in the file are comma separated and either floats or ints. Most of the values are 10
. I want to read the data into a numpy array. Currently, I'm using numpy.fromfile
:
>>> import numpy
>>> f = open('distance_matrix.tmp')
>>> distance_matrix = numpy.fromfile(f, sep=',')
but that has been running for over an hour now and it's currently using ~1 Gig memory, so I don't think it's halfway yet.
Is there a faster way to read in large data that is on a single line?