what's the best way to replace any string in a dataframe?
The SPECIAL_NEEDS
contains loads of free text and i cant delete the column/row as there is data in the other rows and columns. So i figured, why not just change the free text into a empty string ''
I'm currently working with this but its throwing errors?
df['SPECIAL_NEEDS'] = df['SPECIAL_NEEDS'].str.replace(str, '', regex=True)
CodePudding user response:
What do you mean by free text? Any content should just be overwritten? In this case use:
df['SPECIAL_NEEDS'] = ""
Or just cases where the row value is a string?