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

2019-10-22 Thread Richard Damon
On 10/21/19 4:36 PM, doganad...@gmail.com wrote:
> On Monday, October 21, 2019 at 4:09:23 PM UTC+3, Piet van Oostrum wrote:
>> Piet van Oostrum  writes:
>>
>>> doganad...@gmail.com writes:
>>>
 I dont know much about scala actually. I have just have tried to give
 0.0001 and it returned a presentation with an 'e' .whereas python takes
 0.0001 and gives 0.0001 . it made me think python is better in that
 specific subject.

 However, python though starts to give 'e' number when 5 decimals are
 given as input. Although there can be systems around which are better in
 this subject other things I can achieve in python overrides some
 disadvantages.
>>> Yes, I would say Python is more user-friendly in this particular
>>> example, although both outputs are correct. If I remember correctly,
>>> Python had an update in the area several years ago to make the output
>>> for floating-point numbers more user-friendly, (and at the same time
>>> maybe even more correct).
>>>
>>> But these are just choices of the implementers of the language, not
>>> characteristics of the language itself.
>> In Python 0.1 => 1e-05, so it just chooses a different point to
>> switch from pure decimal to scientific notation.
>> -- 
>> Pieter van Oostrum 
>> WWW: http://piet.vanoostrum.org/
>> PGP key: [8DAE142BE17999C4]
>
> They ought to have a reason to make the program switch from pure decimal to 
> scientific notation representation. I don't know that reason. Getting along 
> with it.

The basic reason is readability. A number like 0.0001 is
obviously fairly hard to read a see exactly what the value is. A number
like 0.1 isn't. So somewhere you need to change from fixed point to
exponential notation. A common criteria is about when the fixed point
number takes more space to represent than the exponential. 1.2E-05 takes
7 characters, 0.15 takes 8 so the exponential is shorter.

As an aside, I would be very leery of numbers like 0.1 or 1e-05 as
they only show 1 significant digit, so unless I have good reason to
believe that they are exact numbers, I would have concern of them being
very imprecise, and possibly just noise.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread doganadres
For me. 
The problem is solved. Thank you for your participation.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread Joel Goldstick
On Mon, Oct 21, 2019 at 4:59 PM Chris Angelico  wrote:
>
> On Tue, Oct 22, 2019 at 7:41 AM  wrote:
> >
> > They ought to have a reason to make the program switch from pure decimal to 
> > scientific notation representation. I don't know that reason. Getting along 
> > with it.
> >
>
> This is JUST a default display representation. Nothing more. If you
> care about how something is displayed, just use a formatting tool.
> That's all you need to do.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list

Exactly!

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread Chris Angelico
On Tue, Oct 22, 2019 at 7:41 AM  wrote:
>
> They ought to have a reason to make the program switch from pure decimal to 
> scientific notation representation. I don't know that reason. Getting along 
> with it.
>

This is JUST a default display representation. Nothing more. If you
care about how something is displayed, just use a formatting tool.
That's all you need to do.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread doganadres
On Monday, October 21, 2019 at 4:09:23 PM UTC+3, Piet van Oostrum wrote:
> Piet van Oostrum  writes:
> 
> > doganad...@gmail.com writes:
> >
> >> I dont know much about scala actually. I have just have tried to give
> >> 0.0001 and it returned a presentation with an 'e' .whereas python takes
> >> 0.0001 and gives 0.0001 . it made me think python is better in that
> >> specific subject.
> >>
> >> However, python though starts to give 'e' number when 5 decimals are
> >> given as input. Although there can be systems around which are better in
> >> this subject other things I can achieve in python overrides some
> >> disadvantages.
> >
> > Yes, I would say Python is more user-friendly in this particular
> > example, although both outputs are correct. If I remember correctly,
> > Python had an update in the area several years ago to make the output
> > for floating-point numbers more user-friendly, (and at the same time
> > maybe even more correct).
> >
> > But these are just choices of the implementers of the language, not
> > characteristics of the language itself.
> 
> In Python 0.1 => 1e-05, so it just chooses a different point to
> switch from pure decimal to scientific notation.
> -- 
> Pieter van Oostrum 
> WWW: http://piet.vanoostrum.org/
> PGP key: [8DAE142BE17999C4]


They ought to have a reason to make the program switch from pure decimal to 
scientific notation representation. I don't know that reason. Getting along 
with it.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread Piet van Oostrum
Piet van Oostrum  writes:

> doganad...@gmail.com writes:
>
>> I dont know much about scala actually. I have just have tried to give
>> 0.0001 and it returned a presentation with an 'e' .whereas python takes
>> 0.0001 and gives 0.0001 . it made me think python is better in that
>> specific subject.
>>
>> However, python though starts to give 'e' number when 5 decimals are
>> given as input. Although there can be systems around which are better in
>> this subject other things I can achieve in python overrides some
>> disadvantages.
>
> Yes, I would say Python is more user-friendly in this particular
> example, although both outputs are correct. If I remember correctly,
> Python had an update in the area several years ago to make the output
> for floating-point numbers more user-friendly, (and at the same time
> maybe even more correct).
>
> But these are just choices of the implementers of the language, not
> characteristics of the language itself.

In Python 0.1 => 1e-05, so it just chooses a different point to
switch from pure decimal to scientific notation.
-- 
Pieter van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-21 Thread Piet van Oostrum
doganad...@gmail.com writes:

> I dont know much about scala actually. I have just have tried to give
> 0.0001 and it returned a presentation with an 'e' .whereas python takes
> 0.0001 and gives 0.0001 . it made me think python is better in that
> specific subject.
>
> However, python though starts to give 'e' number when 5 decimals are
> given as input. Although there can be systems around which are better in
> this subject other things I can achieve in python overrides some
> disadvantages.

Yes, I would say Python is more user-friendly in this particular example, 
although both outputs are correct. If I remember correctly, Python had an 
update in the area several years ago to make the output for floating-point 
numbers more user-friendly, (and at the same time maybe even more correct).

But these are just choices of the implementers of the language, not 
characteristics of the language itself.
-- 
Pieter van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-20 Thread Joel Goldstick
On Sun, Oct 20, 2019 at 6:06 PM  wrote:
>
>
> my statement may seem unlogical while evaluating and comparing the languages 
> as a whole..
>
> I thought when I give a small number into the programme , the more decimals I 
> can see after the dot as an output, the more human readable it is.
>
> when I see a bunch of numbers with 'e' s I know the numbers are small but it 
> is hard for me to compare it to other numbers with 'e'. , specially with the 
> human eye.
>
> I dont know much about scala actually. I have just have tried to give 0.0001 
> and it returned a presentation with an 'e' .whereas python takes 0.0001 and 
> gives 0.0001 . it made me think python is better in that specific subject.
>
> However, python though starts to give 'e' number when 5 decimals are given as 
> input.  Although  there can be systems around which are better in this 
> subject other things I can achieve in python overrides some disadvantages.
> --
> https://mail.python.org/mailman/listinfo/python-list

The question here has nothing to do with a programming language.  As a
bystander, this thread is interesting in a strange way.  We have a
poster who has no programming experience, no background to understand
floating point numbers, no concept of the difference between an
internal computer usable representation of a number, and a human
readable representation.

I am sure I am much older than many people here.  When I first learned
about computers, and programming, and number formats, I also learned
about binary numbers, how computers perform arithmetic calculations at
a bit level, and lots of things no one really cares about today.  Fast
forward and we have a person who (I'm guessing) is trying to write a
program to complete some schoolwork in a subject far afield for
learning about computer programming.  Although the problem to be
solved seems to be statistical or somehow numeric, the poster doesn't
seem to understand so much about the math either, having gone haywire
over exponential notation.   It is great that computers are so
commonplace that problems can be studied and solved with them when the
problem solver has so little basic understanding of the tool he is
using.  But the thread shows the downside to lacking the basics about
the tool.

I don't mean any negative connotation toward to original poster.  The
problem he poses is legitimate, and confounding for him and for those
who have tried to answer him here since there are these hard
disconnects about concepts that are required to understand the
question.  Its a problem that everyone confronts daily -- No one
really knows how anything works under the hood.   Think: car, toaster,
microwave oven, Facebook algorithms, light bulbs, and on and on

-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-20 Thread doganadres


my statement may seem unlogical while evaluating and comparing the languages as 
a whole..

I thought when I give a small number into the programme , the more decimals I 
can see after the dot as an output, the more human readable it is.

when I see a bunch of numbers with 'e' s I know the numbers are small but it is 
hard for me to compare it to other numbers with 'e'. , specially with the human 
eye.

I dont know much about scala actually. I have just have tried to give 0.0001 
and it returned a presentation with an 'e' .whereas python takes 0.0001 and 
gives 0.0001 . it made me think python is better in that specific subject.

However, python though starts to give 'e' number when 5 decimals are given as 
input.  Although  there can be systems around which are better in this subject 
other things I can achieve in python overrides some disadvantages.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-20 Thread Piet van Oostrum
doganad...@gmail.com writes:

>
> In the meanwhile I have checked Scala , and it's more limited then Python.
> As an example:
> 0.0001
> 1.0E-4: Double
>
Why do you think this means Scala is more limited than Python?
-- 
Piet van Oostrum 
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Thomas Jollans

On 18/10/2019 10:35, doganad...@gmail.com wrote:

Here is my question:


I am using the numpy.std formula to calculate the standart deviation. However, 
the result comes as a number in scientific notation.
Therefore I am asking, How to convert a scientific notation to decimal number, 
and still keep the data format as float64 ?

Or is there any workaround to get the initial standart deviation result as a 
decimal number?


Here is my code:

stdev=numpy.std(dataset)
print(stdev)
 Result: 4.449e-05


print(stdev.dtype)
 Result: float64


Solutions such as this:

stdev=format(stdev, '.10f')
converts the data into a string object! which I don't want.


Expected result: I am willing to have a result as a decimal number in a float64 
format.


Float64 is a binary number format, not a decimal format. What you ask 
can't be done.


As to what you want:

For most purposes, you can think of the float64 object storing the 
Platonic ideal of the number, not any particular representation of it. 
0.5 and 5E-5 are the same number. End of story.


If you want to work with the number, you don't care what it looks like. 
If you want to display the number, you do care what it looks like, and 
you want a str rather than a float.





System: (Python 3.7.4 running on Win10)


Regards,



--
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread doganadres
On Friday, October 18, 2019 at 5:53:24 PM UTC+3, Richard Damon wrote:
> On 10/18/19 9:45 AM, doganad...@gmail.com wrote:
> > On Friday, October 18, 2019 at 4:17:51 PM UTC+3, Richard Damon wrote:
> >> On 10/18/19 9:03 AM, doganad...@gmail.com wrote:
> >>> On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote:
>  On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
> > Here is my question:
> >
> >
> > I am using the numpy.std formula to calculate the standart deviation. 
> > However, the result comes as a number in scientific notation.
> > Therefore I am asking, How to convert a scientific notation to decimal 
> > number, and still keep the data format as float64 ?
> >
> > Or is there any workaround to get the initial standart deviation result 
> > as a decimal number?
> >
> >
> > Here is my code:
> >
> > stdev=numpy.std(dataset)
> > print(stdev)
> > Result: 4.449e-05
> >
> >
> > print(stdev.dtype)
> > Result: float64
> >
> >
> > Solutions such as this:
> >
> > stdev=format(stdev, '.10f')
> > converts the data into a string object! which I don't want.
> >
> >
> > Expected result: I am willing to have a result as a decimal number in a 
> > float64 format.
> >
> > System: (Python 3.7.4 running on Win10)
> >
> >
> > Regards, 
>  The number itself isn't in scientific notation or a fixed point number,
>  but is a floating point number that is expressed internally as an
>  integer times a power of 2 (that is the basic representation format for
>  floating point).
> 
>  Scientific notation vs fixed point notation is purely an OUTPUT
>  configuration, not a function on how the number is stored (so in one
>  sense IS more closely linked to a string than the float itself).
> 
>  -- 
>  Richard Damon
> >>> Hello Richard,
> >>>
> >>> You seem so right. But what will we do with those strings with 'e' in it?
> >>>
> >>> There are ways to present those in a 'normal' way with formatting. 
> >>> However, the result of those formatting turns them into str object and 
> >>> which limits you to do any further numerical things with them.
> >>>
> >>> Another thing which I have observed, while doing some experimental thing 
> >>> is that:
> >>>
> >> 0.0
> >>> 0.0
> >>>
> >> 0.1
> >>> 0.1
> >>>
> >> 0.01
> >>> 0.01
> >>>
> >> 0.001
> >>> 0.001
> >>>
> >> 0.0001
> >>> 0.0001
> >>>
> >> 0.1
> >>> 1e-05
> >>>
> >>> Again another thing with 1e-05! instead of 0.1 , Is there anything I 
> >>> can do about it?
> >> The 'e' is only part of the string representation presentation of the
> >> value. By default, python decides to present small numbers in
> >> exponential format.  If you don't like that, when you print the numbers
> >> specify the format YOU want, rather than taking the default.
> >>
> >> Note, that print() by necessity converts an objects value to a string,
> >> and this conversion for floats uses exponential notation by default for
> >> small numbers. If you don't like it, then use an explicit format for the
> >> conversion.
> >>
> >> An alternative might be to change from using a float64 to making it
> >> something like a Decimal.
> >>
> >> -- 
> >> Richard Damon
> >
> > 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.
> >
> > what sould I do?
> >
> > Should I consider using another programming language?
> >
> > If yes, then this language could be callable from within python and I might 
> > do things I can.
> 
> The problem is you are thinking of your floating point number as storing
> something like 5e-5 or 0.5, it doesn't. it store something more like
> 1.6384 x 2**15 (or some really big 50 some bit integer time a different
> power of 2). As your words said, it SHOWS it with an e, but that isn't
> what is in the number. The number is just a number represented as a float.
> 

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

2019-10-18 Thread doganadres
On Friday, October 18, 2019 at 4:55:33 PM UTC+3, Chris Angelico wrote:
> On Sat, Oct 19, 2019 at 12:51 AM  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.0001 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


Thank you Chris, I will answer down below, on Richard's
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Richard Damon
On 10/18/19 9:45 AM, doganad...@gmail.com wrote:
> On Friday, October 18, 2019 at 4:17:51 PM UTC+3, Richard Damon wrote:
>> On 10/18/19 9:03 AM, doganad...@gmail.com wrote:
>>> On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote:
 On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
> Here is my question:
>
>
> I am using the numpy.std formula to calculate the standart deviation. 
> However, the result comes as a number in scientific notation.
> Therefore I am asking, How to convert a scientific notation to decimal 
> number, and still keep the data format as float64 ?
>
> Or is there any workaround to get the initial standart deviation result 
> as a decimal number?
>
>
> Here is my code:
>
> stdev=numpy.std(dataset)
> print(stdev)
> Result: 4.449e-05
>
>
> print(stdev.dtype)
> Result: float64
>
>
> Solutions such as this:
>
> stdev=format(stdev, '.10f')
> converts the data into a string object! which I don't want.
>
>
> Expected result: I am willing to have a result as a decimal number in a 
> float64 format.
>
> System: (Python 3.7.4 running on Win10)
>
>
> Regards, 
 The number itself isn't in scientific notation or a fixed point number,
 but is a floating point number that is expressed internally as an
 integer times a power of 2 (that is the basic representation format for
 floating point).

 Scientific notation vs fixed point notation is purely an OUTPUT
 configuration, not a function on how the number is stored (so in one
 sense IS more closely linked to a string than the float itself).

 -- 
 Richard Damon
>>> Hello Richard,
>>>
>>> You seem so right. But what will we do with those strings with 'e' in it?
>>>
>>> There are ways to present those in a 'normal' way with formatting. However, 
>>> the result of those formatting turns them into str object and which limits 
>>> you to do any further numerical things with them.
>>>
>>> Another thing which I have observed, while doing some experimental thing is 
>>> that:
>>>
>> 0.0
>>> 0.0
>>>
>> 0.1
>>> 0.1
>>>
>> 0.01
>>> 0.01
>>>
>> 0.001
>>> 0.001
>>>
>> 0.0001
>>> 0.0001
>>>
>> 0.1
>>> 1e-05
>>>
>>> Again another thing with 1e-05! instead of 0.1 , Is there anything I 
>>> can do about it?
>> The 'e' is only part of the string representation presentation of the
>> value. By default, python decides to present small numbers in
>> exponential format.  If you don't like that, when you print the numbers
>> specify the format YOU want, rather than taking the default.
>>
>> Note, that print() by necessity converts an objects value to a string,
>> and this conversion for floats uses exponential notation by default for
>> small numbers. If you don't like it, then use an explicit format for the
>> conversion.
>>
>> An alternative might be to change from using a float64 to making it
>> something like a Decimal.
>>
>> -- 
>> Richard Damon
>
> 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.
>
> what sould I do?
>
> Should I consider using another programming language?
>
> If yes, then this language could be callable from within python and I might 
> do things I can.

The problem is you are thinking of your floating point number as storing
something like 5e-5 or 0.5, it doesn't. it store something more like
1.6384 x 2**15 (or some really big 50 some bit integer time a different
power of 2). As your words said, it SHOWS it with an e, but that isn't
what is in the number. The number is just a number represented as a float.

If you don't what to print them with the e, then format them when you
print to be the way you want.

As to the excel, you aren't being very clear about how you are
generating the excel file. If you are directly generating an .xls file,
then I believe you want to store the float64 value directly into it, and
their is no 

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

2019-10-18 Thread Chris Angelico
On Sat, Oct 19, 2019 at 12:51 AM  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.0001 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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread doganadres
On Friday, October 18, 2019 at 4:17:51 PM UTC+3, Richard Damon wrote:
> On 10/18/19 9:03 AM, doganad...@gmail.com wrote:
> > On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote:
> >> On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
> >>> Here is my question:
> >>>
> >>>
> >>> I am using the numpy.std formula to calculate the standart deviation. 
> >>> However, the result comes as a number in scientific notation.
> >>> Therefore I am asking, How to convert a scientific notation to decimal 
> >>> number, and still keep the data format as float64 ?
> >>>
> >>> Or is there any workaround to get the initial standart deviation result 
> >>> as a decimal number?
> >>>
> >>>
> >>> Here is my code:
> >>>
> >>> stdev=numpy.std(dataset)
> >>> print(stdev)
> >>> Result: 4.449e-05
> >>>
> >>>
> >>> print(stdev.dtype)
> >>> Result: float64
> >>>
> >>>
> >>> Solutions such as this:
> >>>
> >>> stdev=format(stdev, '.10f')
> >>> converts the data into a string object! which I don't want.
> >>>
> >>>
> >>> Expected result: I am willing to have a result as a decimal number in a 
> >>> float64 format.
> >>>
> >>> System: (Python 3.7.4 running on Win10)
> >>>
> >>>
> >>> Regards, 
> >> The number itself isn't in scientific notation or a fixed point number,
> >> but is a floating point number that is expressed internally as an
> >> integer times a power of 2 (that is the basic representation format for
> >> floating point).
> >>
> >> Scientific notation vs fixed point notation is purely an OUTPUT
> >> configuration, not a function on how the number is stored (so in one
> >> sense IS more closely linked to a string than the float itself).
> >>
> >> -- 
> >> Richard Damon
> >
> > Hello Richard,
> >
> > You seem so right. But what will we do with those strings with 'e' in it?
> >
> > There are ways to present those in a 'normal' way with formatting. However, 
> > the result of those formatting turns them into str object and which limits 
> > you to do any further numerical things with them.
> >
> > Another thing which I have observed, while doing some experimental thing is 
> > that:
> >
>  0.0
> > 0.0
> >
>  0.1
> > 0.1
> >
>  0.01
> > 0.01
> >
>  0.001
> > 0.001
> >
>  0.0001
> > 0.0001
> >
>  0.1
> > 1e-05
> >
> > Again another thing with 1e-05! instead of 0.1 , Is there anything I 
> > can do about it?
> 
> The 'e' is only part of the string representation presentation of the
> value. By default, python decides to present small numbers in
> exponential format.  If you don't like that, when you print the numbers
> specify the format YOU want, rather than taking the default.
> 
> Note, that print() by necessity converts an objects value to a string,
> and this conversion for floats uses exponential notation by default for
> small numbers. If you don't like it, then use an explicit format for the
> conversion.
> 
> An alternative might be to change from using a float64 to making it
> something like a Decimal.
> 
> -- 
> Richard Damon


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.

what sould I do?

Should I consider using another programming language?

If yes, then this language could be callable from within python and I might do 
things I can.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Richard Damon
On 10/18/19 9:03 AM, doganad...@gmail.com wrote:
> On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote:
>> On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
>>> Here is my question:
>>>
>>>
>>> I am using the numpy.std formula to calculate the standart deviation. 
>>> However, the result comes as a number in scientific notation.
>>> Therefore I am asking, How to convert a scientific notation to decimal 
>>> number, and still keep the data format as float64 ?
>>>
>>> Or is there any workaround to get the initial standart deviation result as 
>>> a decimal number?
>>>
>>>
>>> Here is my code:
>>>
>>> stdev=numpy.std(dataset)
>>> print(stdev)
>>> Result: 4.449e-05
>>>
>>>
>>> print(stdev.dtype)
>>> Result: float64
>>>
>>>
>>> Solutions such as this:
>>>
>>> stdev=format(stdev, '.10f')
>>> converts the data into a string object! which I don't want.
>>>
>>>
>>> Expected result: I am willing to have a result as a decimal number in a 
>>> float64 format.
>>>
>>> System: (Python 3.7.4 running on Win10)
>>>
>>>
>>> Regards, 
>> The number itself isn't in scientific notation or a fixed point number,
>> but is a floating point number that is expressed internally as an
>> integer times a power of 2 (that is the basic representation format for
>> floating point).
>>
>> Scientific notation vs fixed point notation is purely an OUTPUT
>> configuration, not a function on how the number is stored (so in one
>> sense IS more closely linked to a string than the float itself).
>>
>> -- 
>> Richard Damon
>
> Hello Richard,
>
> You seem so right. But what will we do with those strings with 'e' in it?
>
> There are ways to present those in a 'normal' way with formatting. However, 
> the result of those formatting turns them into str object and which limits 
> you to do any further numerical things with them.
>
> Another thing which I have observed, while doing some experimental thing is 
> that:
>
 0.0
> 0.0
>
 0.1
> 0.1
>
 0.01
> 0.01
>
 0.001
> 0.001
>
 0.0001
> 0.0001
>
 0.1
> 1e-05
>
> Again another thing with 1e-05! instead of 0.1 , Is there anything I can 
> do about it?

The 'e' is only part of the string representation presentation of the
value. By default, python decides to present small numbers in
exponential format.  If you don't like that, when you print the numbers
specify the format YOU want, rather than taking the default.

Note, that print() by necessity converts an objects value to a string,
and this conversion for floats uses exponential notation by default for
small numbers. If you don't like it, then use an explicit format for the
conversion.

An alternative might be to change from using a float64 to making it
something like a Decimal.

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Richard Damon
On 10/18/19 8:52 AM, doganad...@gmail.com wrote:
> On Friday, October 18, 2019 at 2:46:42 PM UTC+3, Gys wrote:
>> On 10/18/19 10:35 AM, doganad...@gmail.com wrote:
>>> Here is my question:
>>>
>>>
>>> I am using the numpy.std formula to calculate the standart deviation. 
>>> However, the result comes as a number in scientific notation.
>>> Therefore I am asking, How to convert a scientific notation to decimal 
>>> number, and still keep the data format as float64 ?
>>>
>>> Or is there any workaround to get the initial standart deviation result as 
>>> a decimal number?
>>>
>>>
>>> Here is my code:
>>>
>>> stdev=numpy.std(dataset)
>>> print(stdev)
>>>  Result: 4.449e-05
>>>
>>>
>>> print(stdev.dtype)
>>>  Result: float64
>>>
>>>
>>> Solutions such as this:
>>>
>>> stdev=format(stdev, '.10f')
>>> converts the data into a string object! which I don't want.
>>>
>>>
>>> Expected result: I am willing to have a result as a decimal number in a 
>>> float64 format.
>>>
>>> System: (Python 3.7.4 running on Win10)
>>>
>>>
>>> Regards,
>>>
>> Hi, doganad...@gmail.com
>>
>> why don't you use
>>
>> print("{0:10.5f}".format(x))
>>
>> The only thing you want is a specific form of the human readable 
>> representation of the number. For this it is not necessary the convert 
>> the  *number* itself definitely to a string. You only have to make a 
>> temp copy of x for printing purposes.
>>
>> Linux Mint Tara in Spyder(Python 3.6) :
>>
>> x=4.449e-05
>>
>> print(x)
>> 4.449e-05
>>
>> print("{0:8.5f}".format(x))
>>   0.5
>>
>> print(x)
>> 4.449e-05
>>
>> hth
>> Gys
> Hello,
>
> I don't only need a human readable representation of number, I need to use it 
> further, do things such as putting it in a pandas object and saving it to an 
> excel file.
>
> Doing things such as 
> x="{0:10.5f}".format(x)
> gives a str object as a result:
> 

If you are going to use it further as a floating point binary number,
why do you need to do ANYTHING to it. As I said, the exponential format
is just a string representation of the binary value (just like the
0.0005 is).

If you put it into something that stores the float64 representation,
that doesn't have anything like an exponential vs decimal format.
(Depending on how you put it into excel, that may actually use a string
representation if something like a CSV file.)

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread doganadres
On Friday, October 18, 2019 at 2:21:34 PM UTC+3, Richard Damon wrote:
> On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
> > Here is my question:
> >
> >
> > I am using the numpy.std formula to calculate the standart deviation. 
> > However, the result comes as a number in scientific notation.
> > Therefore I am asking, How to convert a scientific notation to decimal 
> > number, and still keep the data format as float64 ?
> >
> > Or is there any workaround to get the initial standart deviation result as 
> > a decimal number?
> >
> >
> > Here is my code:
> >
> > stdev=numpy.std(dataset)
> > print(stdev)
> > Result: 4.449e-05
> >
> >
> > print(stdev.dtype)
> > Result: float64
> >
> >
> > Solutions such as this:
> >
> > stdev=format(stdev, '.10f')
> > converts the data into a string object! which I don't want.
> >
> >
> > Expected result: I am willing to have a result as a decimal number in a 
> > float64 format.
> >
> > System: (Python 3.7.4 running on Win10)
> >
> >
> > Regards, 
> 
> The number itself isn't in scientific notation or a fixed point number,
> but is a floating point number that is expressed internally as an
> integer times a power of 2 (that is the basic representation format for
> floating point).
> 
> Scientific notation vs fixed point notation is purely an OUTPUT
> configuration, not a function on how the number is stored (so in one
> sense IS more closely linked to a string than the float itself).
> 
> -- 
> Richard Damon


Hello Richard,

You seem so right. But what will we do with those strings with 'e' in it?

There are ways to present those in a 'normal' way with formatting. However, the 
result of those formatting turns them into str object and which limits you to 
do any further numerical things with them.

Another thing which I have observed, while doing some experimental thing is 
that:

>>> 0.0
0.0

>>> 0.1
0.1

>>> 0.01
0.01

>>> 0.001
0.001

>>> 0.0001
0.0001

>>> 0.1
1e-05

Again another thing with 1e-05! instead of 0.1 , Is there anything I can do 
about it?
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread doganadres
On Friday, October 18, 2019 at 2:46:42 PM UTC+3, Gys wrote:
> On 10/18/19 10:35 AM, doganad...@gmail.com wrote:
> > 
> > Here is my question:
> > 
> > 
> > I am using the numpy.std formula to calculate the standart deviation. 
> > However, the result comes as a number in scientific notation.
> > Therefore I am asking, How to convert a scientific notation to decimal 
> > number, and still keep the data format as float64 ?
> > 
> > Or is there any workaround to get the initial standart deviation result as 
> > a decimal number?
> > 
> > 
> > Here is my code:
> > 
> > stdev=numpy.std(dataset)
> > print(stdev)
> >  Result: 4.449e-05
> > 
> > 
> > print(stdev.dtype)
> >  Result: float64
> > 
> > 
> > Solutions such as this:
> > 
> > stdev=format(stdev, '.10f')
> > converts the data into a string object! which I don't want.
> > 
> > 
> > Expected result: I am willing to have a result as a decimal number in a 
> > float64 format.
> > 
> > System: (Python 3.7.4 running on Win10)
> > 
> > 
> > Regards,
> > 
> 
> Hi, doganad...@gmail.com
> 
> why don't you use
> 
> print("{0:10.5f}".format(x))
> 
> The only thing you want is a specific form of the human readable 
> representation of the number. For this it is not necessary the convert 
> the  *number* itself definitely to a string. You only have to make a 
> temp copy of x for printing purposes.
> 
> Linux Mint Tara in Spyder(Python 3.6) :
> 
> x=4.449e-05
> 
> print(x)
> 4.449e-05
> 
> print("{0:8.5f}".format(x))
>   0.5
> 
> print(x)
> 4.449e-05
> 
> hth
> Gys

Hello,

I don't only need a human readable representation of number, I need to use it 
further, do things such as putting it in a pandas object and saving it to an 
excel file.

Doing things such as 
x="{0:10.5f}".format(x)
gives a str object as a result:

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Gys

On 10/18/19 10:35 AM, doganad...@gmail.com wrote:


Here is my question:


I am using the numpy.std formula to calculate the standart deviation. However, 
the result comes as a number in scientific notation.
Therefore I am asking, How to convert a scientific notation to decimal number, 
and still keep the data format as float64 ?

Or is there any workaround to get the initial standart deviation result as a 
decimal number?


Here is my code:

stdev=numpy.std(dataset)
print(stdev)
 Result: 4.449e-05


print(stdev.dtype)
 Result: float64


Solutions such as this:

stdev=format(stdev, '.10f')
converts the data into a string object! which I don't want.


Expected result: I am willing to have a result as a decimal number in a float64 
format.

System: (Python 3.7.4 running on Win10)


Regards,



Hi, doganad...@gmail.com

why don't you use

print("{0:10.5f}".format(x))

The only thing you want is a specific form of the human readable 
representation of the number. For this it is not necessary the convert 
the  *number* itself definitely to a string. You only have to make a 
temp copy of x for printing purposes.


Linux Mint Tara in Spyder(Python 3.6) :

x=4.449e-05

print(x)
4.449e-05

print("{0:8.5f}".format(x))
 0.5

print(x)
4.449e-05

hth
Gys
--
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread Richard Damon
On 10/18/19 4:35 AM, doganad...@gmail.com wrote:
> Here is my question:
>
>
> I am using the numpy.std formula to calculate the standart deviation. 
> However, the result comes as a number in scientific notation.
> Therefore I am asking, How to convert a scientific notation to decimal 
> number, and still keep the data format as float64 ?
>
> Or is there any workaround to get the initial standart deviation result as a 
> decimal number?
>
>
> Here is my code:
>
> stdev=numpy.std(dataset)
> print(stdev)
> Result: 4.449e-05
>
>
> print(stdev.dtype)
> Result: float64
>
>
> Solutions such as this:
>
> stdev=format(stdev, '.10f')
> converts the data into a string object! which I don't want.
>
>
> Expected result: I am willing to have a result as a decimal number in a 
> float64 format.
>
> System: (Python 3.7.4 running on Win10)
>
>
> Regards, 

The number itself isn't in scientific notation or a fixed point number,
but is a floating point number that is expressed internally as an
integer times a power of 2 (that is the basic representation format for
floating point).

Scientific notation vs fixed point notation is purely an OUTPUT
configuration, not a function on how the number is stored (so in one
sense IS more closely linked to a string than the float itself).

-- 
Richard Damon

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2019-10-18 Thread doganadres


Here is my question:


I am using the numpy.std formula to calculate the standart deviation. However, 
the result comes as a number in scientific notation.
Therefore I am asking, How to convert a scientific notation to decimal number, 
and still keep the data format as float64 ?

Or is there any workaround to get the initial standart deviation result as a 
decimal number?


Here is my code:

stdev=numpy.std(dataset)
print(stdev)
Result: 4.449e-05


print(stdev.dtype)
Result: float64


Solutions such as this:

stdev=format(stdev, '.10f')
converts the data into a string object! which I don't want.


Expected result: I am willing to have a result as a decimal number in a float64 
format.

System: (Python 3.7.4 running on Win10)


Regards, 
-- 
https://mail.python.org/mailman/listinfo/python-list