[Numpy-discussion] [Fwd: compression in storage of Numeric/numarray objects]

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Sep 9 13:08:12 CDT 2005

>>>>> "Joost" == Joost van Evert <phjoost at gmail.com> writes:

    Joost> is it possible to use compression while storing
    Joost> numarray/Numeric objects?


    In [35]: s = rand(10000)

    In [36]: file('uncompressed.dat', 'wb').write(s.tostring())

    In [37]: ls -l uncompressed.dat
    -rw-r--r--  1 jdhunter jdhunter 80000 2005-09-09 15:04 uncompressed.dat

    In [38]: gzip.open('compressed.dat', 'wb').write(s.tostring())

    In [39]: ls -l compressed.dat
    -rw-r--r--  1 jdhunter jdhunter 41393 2005-09-09 15:04 compressed.dat

Compression ration for more regular data will be better.


More information about the Numpy-discussion mailing list