[Numpy-discussion] how to pipe into numpy arrays?

Benjamin Root ben.root at ou.edu
Wed Oct 24 21:19:03 EDT 2012


On Wed, Oct 24, 2012 at 3:00 PM, Michael Aye <kmichael.aye at gmail.com> wrote:

> As numpy.fromfile seems to require full file object functionalities
> like seek, I can not use it with the sys.stdin pipe.
> So how could I stream a binary pipe directly into numpy?
> I can imagine storing the data in a string and use StringIO but the
> files are 3.6 GB large, just the binary, and that will most likely be
> much more as a string object.
> Reading binary files on disk is NOT the problem, I would like to avoid
> the temporary file if possible.
>
>
I haven't tried this myself, but there is a numpy.frombuffer() function as
well.  Maybe that could be used here?

Cheers!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20121024/440a2d03/attachment.html>


More information about the NumPy-Discussion mailing list