numpy.savetxt() outputs very large files numpy.savetxt() outputs very large files numpy numpy

numpy.savetxt() outputs very large files


The size of the native datatype differs from the size of the string representation of the datatype.

numpy.savetxt has a fmt argument that defaults to '%.18e', which formats each of your zeros as 0.000000000000000000e+00. That is 24 characters per item plus one for the delimiter.

To get a smaller file you can change the format (beware of losing significant digits) or use numpy.save to save in binary or numpy.savez to save as a compressed archive.