Convert a scientific notation to decimal number, and still keeping the data format as float64

Chris Angelico rosuav at gmail.com
Fri Oct 18 09:55:05 EDT 2019


On Sat, Oct 19, 2019 at 12:51 AM <doganadres at gmail.com> wrote:
> By taking the default OUTPUT of a numpy formula, in my case standart deviation, I am using the advantage of saving the result into an excel file without any problems.(they come as numpy.float64) From there, The excel takes all the things as they are and some of my small numbers are shown with the 'e' on the excel sheet. Which I am trying to avoid.
>
> I don't need 100 numbers after the comma. What I need is a reasonable amount of decimal numbers to show that the number is small enough, also keeping them in float64, in my case to save them into excel file. One important thing to say is that, if I convert them into string and save them on excel they come with 'dot' instead of comma. And If try to translate the 'dot' manually into 'comma' the excel gives warning message to turn those inputs into numbers. Which I also avoid.
>
> If this is Python default, showing all numbers smaller than 0.0001 with 'e' and there is no way to have them in both a human readable and excel savable form.
>

You're conflating the number with its representation. Whenever you
display a number, you need a set of digits. The number itself is
exactly the same whether it's written as 0.00000001 or 1e-8 or any
other form, just as you can write a fraction as 3 1/7 or as 22/7 and
it's the same number.

Look at the way you're "saving the result into an Excel file".
Firstly, is it CSV or actually saved into Excel format? Then look at
the way you actually display the number there. In a CSV file, once
again, you need a series of digits, so you simply need to format the
number the way that people have been advising you.

ChrisA



More information about the Python-list mailing list