Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110703
| From | Cody Piersall <cody.piersall@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: fastest way to read a text file in to a numpy array |
| Date | 2016-06-28 09:37 -0500 |
| Message-ID | <mailman.84.1467125140.2358.python-list@python.org> (permalink) |
| References | <37b46ad8-8318-4d67-a65c-7dd7a50a3848@googlegroups.com> <CAFSbXtMu=ipkgi5u+buah7VnkYfz_vD+6ceQk-k_ui_uddfkBQ@mail.gmail.com> |
On Tue, Jun 28, 2016 at 8:45 AM, Heli <hemla21@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
fastest way to read a text file in to a numpy array Heli <hemla21@gmail.com> - 2016-06-28 06:45 -0700
Re: fastest way to read a text file in to a numpy array Michael Selik <michael.selik@gmail.com> - 2016-06-28 14:00 +0000
Re: fastest way to read a text file in to a numpy array Michael Selik <michael.selik@gmail.com> - 2016-06-28 14:29 +0000
Re: fastest way to read a text file in to a numpy array Cody Piersall <cody.piersall@gmail.com> - 2016-06-28 09:37 -0500
Re: fastest way to read a text file in to a numpy array Heli <hemla21@gmail.com> - 2016-06-30 08:49 -0700
Re: fastest way to read a text file in to a numpy array Christian Gollwitzer <auriocus@gmx.de> - 2016-06-30 23:02 +0200
csiph-web