How to do it...

  1. To begin our rounding adventure with operators, we will first add .00501 to each value of college_ugds_:
>>> college_ugds_ + .00501
  1. Use the floor division operator, //, to round to the nearest whole number percentage:
>>> (college_ugds_ + .00501) // .01
  1. To complete the rounding exercise, divide by 100:
>>> college_ugds_op_round = (college_ugds_ + .00501) // .01 / 100
>>> college_ugds_op_round.head()
  1. Now use the round DataFrame method to do the rounding automatically for us. NumPy rounds numbers that are exactly halfway between either side to the even side. Due to this, we add a small fraction before rounding:
>>> college_ugds_round = (college_ugds_ + .00001).round(2)
  1. Use the equals DataFrame method to test the equality of two DataFrames:
>>> college_ugds_op_round.equals(college_ugds_round)
True
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.137.38