0

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)
1
  • could you provide a sample data? it's not clear what the question is here Commented Feb 27, 2022 at 18:04

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.