Apr-06-2017, 12:53 PM
Did you assign result of replace to a new variable? replace does not work in place.
If you need to remove newlines from entire column in a dataframe, you can use
If you need to remove newlines from entire column in a dataframe, you can use
df.iloc[:, 1] = df.iloc[:, 1].str.replace("\n", "")or (removes leading/trailing whitespaces too, but wont remove newline between "words")
df.iloc[:, 1] = df.iloc[:, 1].str.strip()