Re:Is “data scientist” the new “programmer”?
by dekhn on Wednesday September 19, 2018 @09:01AM
(#18023843)
Not only is this technically wrong, but Python has a decimal module for performing these kinds of calculations. It uses floats/doubles for the native float type which produces exactly the type of results you see above.
[ Parent
| on HN ]
Re:Is “data scientist” the new “programmer”?
by darkhorn on Wednesday September 19, 2018 @03:35PM
(#18027055)
What is the result of 3/2? In R it is 0.5. In Python it is 1.
Re:Is “data scientist” the new “programmer”?
by dekhn on Wednesday September 19, 2018 @07:12PM
(#18028406)
You mean, in Python2, which uses integer division by default, it's 1 (as expected), and in Python3, which uses float division by default, it's 1.5.
If R is giving you 0.5, you should find another language (I assume you meant 1.5?)