I have the situation that I have floats (like 1.122, 1.3232, 1.22222) I and need to round it always in line with math rules to 2 decimal places: up if third is 5 or higher, down is third is lower than 5.
Like this (before round -> after round):
1.123 -> 1.12
1.1250 -> 1.13
1.0050 -> 1.01
1.0000 -> 1.00
1.00001 -> 1.00
(always two after ".")
Which way in Python is the best for this? I tried with round function, formatting, numpy, decimal and always sometimes it failed. Hint appreciated !