Skip to content
Advertisement

Python – Applying condition on after decimal point (in dataframe column)

I have a dataframe which contains a column like below,

JavaScript

I have to apply condition after decimal point, Those conditions are, ( (<50)it will replace .0), and (>50) it will replace .5)). How can i do it properly??? Thanks in advance,….

Advertisement

Answer

Just implement your own rounding criteria in a function, and apply the function on required column:

JavaScript

OUTPUT:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement