On Tue, Jun 28, 2016 at 8:45 AM, Heli <heml...@gmail.com> wrote: > Hi, > > I need to read a file in to a 2d numpy array containing many number of lines. > I was wondering what is the fastest way to do this? > > Is even reading the file in to numpy array the best method or there are > better approaches? >
numpy.genfromtxt[1] is a pretty robust function for reading text files. If you're generating the file from a numpy array already, you should use arr.save()[2] and numpy.load()[3]. [1]: http://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html [2]: http://docs.scipy.org/doc/numpy/reference/generated/numpy.save.html [3]: http://docs.scipy.org/doc/numpy/reference/generated/numpy.load.html Cody -- https://mail.python.org/mailman/listinfo/python-list