[Numpy-discussion] output different columns of ndarray in different formats

Chao YUE chaoyuejoy at gmail.com
Thu Dec 22 11:45:04 EST 2011


O.... Yes.... You're right... It's fine now.

Merry Christmas to all!

Chao

2011/12/22 Aronne Merrelli <aronne.merrelli at gmail.com>

>
>
> On Thu, Dec 22, 2011 at 10:27 AM, Chao YUE <chaoyuejoy at gmail.com> wrote:
>
>> Dear all,
>>
>> Just a small question, how can I output different columns of ndarray in
>> different formats,
>> the manual says, "A single format (%10.5f), a sequence of formats, or a
>> multi-format string"
>> but I use
>>
>> np.savetxt('new.csv',data,fmt=['%i4','%f6.3'])
>>
>> or
>>
>> np.savetxt('new.csv',data,fmt=('%i4','%f6.3'))
>>
>> give strange results.
>>
>
>
> I think you've flipped the format codes; try:
>
> fmt = ('%4i', '%6.3f')
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111222/fff5de25/attachment.html>


More information about the NumPy-Discussion mailing list