I have a column which has text in it. I have to replace (':',' ').
When I am running this code:
df["text"] = [x.replace(':',' ') for x in df["text"]]
I am facing the this error:
AttributeError: 'float' object has no attribute 'replace'
AttributeError Traceback (most recent call
last)
<ipython-input-13-3c116e6f21e2> in <module>
1 #df["text"] = df["text"].astype(str)
----> 2 df["text"] = [x.replace(':',' ') for x in df["text"]]
<ipython-input-13-3c116e6f21e2> in <listcomp>(.0)
1 #df["text"] = data["NOTES_ENT"].astype(str)
----> 2 df["text"] = [x.replace(':',' ') for x in df["text"]]
AttributeError: 'float' object has no attribute 'replace'