replace may not work with float because the floating point view you see in repr in the DataFrame may not be the same as the underlying float. For example, the actual Close value might be:
In [141]: df = pd.DataFrame({'Close': [2.389000000001]})
but the df view is as follows:
In [142]: df Out[142]: Close 0 2.389
Therefore, instead of checking equality of float, it is usually better to check proximity:
In [150]: import numpy as np In [151]: mask = np.isclose(df['Close'], 2.389) In [152]: mask Out[152]: array([ True], dtype=bool)
Then you can use the boolean mask to select and change the desired values:
In [145]: df.loc[mask, 'Close'] = np.nan In [146]: df Out[146]: Close 0 NaN
source share