I need to floor a float number with an specific number of decimals.
So:
2.1235 with 2 decimals --> 2.12 2.1276 with 2 decimals --> 2.12 (round
This seems to work (needs no import and works using the // operator which should be faster than numpy, as it simply returns the floor of the division):
a = 2.338888 n_decimals = 2 a = ((a*10**n_decimals)//1)/(10**n_decimals)