[Numpy-discussion] Numpy savetxt: change decimal separator

Gökhan Sever gokhansever@gmail....
Thu Sep 24 08:41:34 CDT 2009


On Thu, Sep 24, 2009 at 2:07 AM, <markus.proeller@ifm.com> wrote:

>
> Hello everyone,
>
> I save data to a file with the following statement:
>
> np.savetxt(fileName, transpose((average_dist, std_deviation, maximum_dist,
> sum_of_dist)), delimiter = ';', fmt='%6.10f')
>
> is there a possibility to change the decimal seperator from a point to
> comma ?
> And another question I import this file to excel, is there also a
> possiblity to create a headline for each column, that the file looks like
> the following example:
>

I don't know how to accomplish the first task, but for the latter the
following lines should work:

fid = open(fileName, 'w')
fid.write("average; standard deviation; maximum distance; sum of distances")
np.savetxt(fid, transpose((average_dist, std_deviation, maximum_dist,
sum_of_dist)), delimiter = ';', fmt='%6.10f')
fid.close()



>
> average; standard deviation; maximum distance; sum of distances
> 0,26565; 0,65565; 2,353535; 25, 5656
> ...
> ...
> ...
>
> Thanks,
>
> Markus
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090924/d739adbe/attachment.html 


More information about the NumPy-Discussion mailing list