0

print(round(1.1990,2))

1.2 The out put I need in pandas is 1.20

1.1-->1.10 1.3-->1.30

Balesh D
  • 11
  • 3
  • `print(round(1.1990,2))` truncates unnecessary zeros at the end. for `1.1` and `1.3` you can't add an additional 0 with round. It sounds like you are using pandas. I will link a question. To solve your problem is actually a little tricky. 1) (Hard solution that changes value) you can do this https://stackoverflow.com/questions/60605697/convert-specific-columns-from-float-to-decimal/60607280#60607280 2) (Easy Solution that changes FORMAT of value but not value itself): https://stackoverflow.com/questions/62846784/change-int-value-to-00-format/62847008#62847008 – David Erickson Jul 17 '20 at 22:41
  • If you can provide a minimum reproducible example with a DATAFRAME (no images) of sample input and expected output, then I can provide a more comprehensive solution that you can test with code: https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples I see this particular question a lot on here myself and could provide a ll of the options. – David Erickson Jul 17 '20 at 22:49

0 Answers0