ceil

Python round to next highest power of 10

Python round to next highest power of 10 Question: How would I manage to perform math.ceil such that a number is assigned to the next highest power of 10? # 0.04 -> 0.1 # 0.7 -> 1 # 1.1 -> 10 # 90 -> 100 # … My current solution is a dictionary that checks …

Total answers: 6

floor and ceil with number of decimals

floor and ceil with number of decimals Question: 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 would give 2.13 which is not what I need) The function np.round accepts a decimals parameter but it appears that …

Total answers: 4

Floor or ceiling of a pandas series in python?

Floor or ceiling of a pandas series in python? Question: I have a pandas series series. If I want to get the element-wise floor or ceiling, is there a built in method or do I have to write the function and use apply? I ask because the data is big so I appreciate efficiency. Also …

Total answers: 5