-
-
Save bogdanRada/3fa72cd2e9b1b870f4769fa556c6c2cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dataset = [18.562874251497007, 20.958083832335326, 18.562874251497007, 19.161676646706585, 22.75449101796407] | |
| diff = 100 - dataset.map(&:floor).reduce(&:+) | |
| rounded_percentages = dataset | |
| .sort_by { |x| x.floor - x} | |
| .map | |
| .with_index { |e, index| index < diff ? e.floor + 1 : e.floor } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment