I pulled off some hair but still cannot obtain a nicely tabulated output.
In a word, I would like the file saved by the .to_csv()
method to look like this:
K0 V0 dK_dT a b
value 237.496942 82.845746 -0.037012 0.000006 1.359708e-08
std 2.094088 0.012948 0.004415 0.000001 1.550236e-09
But with what I can do, print result.to_csv(float_format='%10.2g', sep=' ')
gives me:
K0 V0 dK_dT a b
value " 2.4e+02" " 83" " -0.037" " 5.8e-06" " 1.4e-08"
std " 2.1" " 0.013" " 0.0044" " 1e-06" " 1.6e-09"
- the header does not automatically align.
- the quotes disrupt the equal width flow.
I tried setting quoting
to some csv.QUOTE_MINIMAL
which are essentially ints but with no luck. As far as I know, NumPy can easily do this with savetxt(format='%10.2g')
.
Anything I missed?