Remove white spaces from a float num

I have a column which contains floating point numbers. I want to remove the whitespaces coming before/in between/after the decimal number. Following is the ex.
‘’’
Column A
123.00
8969.0 0
9876.7 0
36987. 5 7
95147. 96
‘’’
I want the intended result to be as :-
‘’’
Column A
123.00
8969.00
9876.70
36987.57
95147.96
‘’’

Use Python’s string.strip() and string.replace(" ", “”) commands.

1 Like

But why I am not getting the values after the decimal while saving the file in excel format?

We would need to see the code you’re using.

Cheers,
Cameron Simpson cs@cskk.id.au

Two obvious possibilities:

  1. Because you are doing something wrong. We don’t know what, because we don’t know what you are doing – you haven’t shown us your code, so we have to guess.
  2. Or it’s just a display issue. Excel is hiding the digits after the decimal. You have to select the cells and click the button on the toolbar to increase the number of visible decimal places from zero to one, two, three, … however many you want to see.