'string.replace deletes whole string in certain cases

I have a data frame in which i convert a float64 column into a string and then drop the .0 off of the end of the string this is working for most values but for the value 50.0 its deleting the entire string so I'm left with a null value. Any ideas what could cause this? below is the two transformations I have on the data frame

Dataframe['Column'] = Dataframe['Column'].astype('string')
Dataframe['Column'] = Dataframe['Column'].str.replace('.0','')

from the few values I've checked it only happens to a few and not all, for a few rows the value is 50.0, 50.0, 49.0, 39.0 and after the transformation above I have the values: , ,49,39



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source