October 2017
Intermediate to advanced
532 pages
16h 10m
English
Step 1 uses the plus operator, which attempts to add a scalar value to each value of each column of the DataFrame. As the columns are all numeric, this operation works as expected. There are some missing values in each of the columns but they stay missing after the operation.
Mathematically, adding .005 should be enough so that the floor division in the next step correctly rounds to the nearest whole percentage. The trouble appears because of the inexactness of floating point numbers:
>>> .045 + .0050.049999999999999996
There is an extra .00001 added to each number to ensure that the floating point representation has the first four digits the same as the actual value. This works because the maximum precision of all the points ...
Read now
Unlock full access