Hi there, It seems a little odd to me that rec2csv would overthrow float formatting, such as FormatFloat(2). I am reading in a file that looks like (with csv2rec):
ES2006a C 2_1 if 23.53 23.66 0.13 0.17 -0.7844 -2.2863 IN 4.819 1.981 2.838 if 0 0 ES2006a C 2_1 it 23.66 23.74 0.08 0.21 -1.3039 -1.7667 PRP 2.802 1.518 1.284 it 0 0 ES2006a C 2_1 was 23.74 23.9 0.16 0.27 -0.663 -2.5537 AUX 2.694 0.955 1.739 was 0 0 ES2006a C 2_1 sent 23.9 24.17 0.27 0.36 -2.62 -4.062 VBN 6.964 1.317 5.647 sent 1 2 And I am doing a few numpy things to it, and then spitting the results back out into a file that ends up looking like this: ES2006a C 2_1 if 23.530000000000001 23.66 0.13 0.170000 00000000001 -0.78439999999999999 -2.2863000000000002 IN 4.819 1.9810000000000001 2.8380000000000001 if 0 0 0.0 ES2006a C 2_1 it 23.66 23.739999999999998 0.08000000000000 0002 0.20999999999999999 -1.3039000000000001 -1.7666999999999999 PRP 2.802 1.518 1.284 it 0 0 0.0 ES2006a C 2_1 was 23.739999999999998 23.899999999999999 0.16 0.27000000000000002 -0.66300000000000003 -2.5537000000000001 AUX 2.694 0.95499999999999996 1.7390000000000001 was 0 0 0.0 ES2006a C 2_1 sent 23.899999999999999 24.170000000000002 0.27000000000000002 0.35999999999999999 -2.6200000000000001 -4.0620000000000003 VBN 6.964 1.3169999999999999 5.6470000000000002 sent 1 2 0.0 which is not at all what I want. I want the numbers to look like the originally did in the input file...or at least better truncated. I tried to use FormatFloat(n), but the documentation (plus the mlib code) says that rec2csv overrides the FormatFloat to get a %r format. My stopgap measure is to create my own FormatFloatForce that looks like this: class FormatFloatForce(mlab.FormatFormatStr): def __init__(self): mlab.FormatFormatStr.__init__(self, "%g") def toval(self, x): return x def fromstr(self, s): return float(s) But this seems rather hideous to me, especially since I have to apply it to every numerical column. Am I simply doing this all wrong? Yours, --Asad. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/rec2csv-forcing-precision-tp40655.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users