Am 17.02.2018 um 19:26 schrieb Sven Schreiber:
Instead I'd suggest to go back to numpy's savetxt, because it
offers
gzip compression "for free", whenever a 'gz' extension is given.
Does that sound like a good idea? I could send a concrete proposal for
gretl_export -- but not for the imminent release.
Here's a new function version for gretl_io.py:
<python>
def gretl_export(X, fname, autodot=1):
from numpy import asmatrix, savetxt
M = asmatrix(X)
r, c = M.shape
if autodot:
fname = gretl_dotdir + fname
ghead = repr(r) + '\t' + repr(c)
savetxt(fname, M, header=ghead, comments='')
</python>
Because of the standard savetxt behavior, if the filename ends with "gz"
it will be automatically compressed. I tested that this works OK
together with gretl's mread() function.
Numpy.savetxt has been in numpy in the necessary form with the comments
and header options since numpy v1.7 (released in 2013).
cheers,
sven