Reading bz2 file into numpy array

Johannes Korn korn at freisingnet.de
Mon Nov 22 04:54:46 EST 2010


Hi,

is there a convenient way to read bz2 files into a numpy array?

I tried:

from bz2 import *
from numpy import *
fd = BZ2File(filename, 'rb')
read_data = fromfile(fd, float32)

but BZ2File doesn't seem to produce a transparent filehandle.

Kind regards!

Johannes



More information about the Python-list mailing list