I have a data frame in pandas with float64
data types.
0.0 0.0 0.0 -0.25 -0.25881904510000003 0.93301270189 0.01
0.0 0.0 0.0 -0.25347200456 -0.20221757232999998 0.9459703993 0.01
0.0 0.0 0.0 -0.25608634008000003 -0.14493185931 0.95572723231 0.01
.
.
.
I would like the data columns to be aligned and to have scientific formatting, like this
0.00E+00 0.00E+00 0.00E+00 -2.50E-01 -2.59E-01 9.33E-01 1.00E-02
0.00E+00 0.00E+00 0.00E+00 -2.53E-01 -2.02E-01 9.46E-01 1.00E-02
0.00E+00 0.00E+00 0.00E+00 -2.56E-01 -1.45E-01 9.56E-01 1.00E-02
.
.
.
Which I can have displayed by setting
pd.set_option('display.float_format', '{:.2E}'.format)
But how do I export the data to have the same formatting?
To export the data I am using
df_rayfile.to_csv(output_file, header=None, index=None, sep=' ')
Setting the display output has no effect on the exported data and by using float_format option in to_cvs I was also not able to get the same output as with setting the display format.