How To Remove Newline In Pandas Dataframe Columns?
I want to shorten and clean up a CSV file to use it in ElasticSearch. but there are line breaks in some Dataframes (cells) and it is not possible to parse the CSV to ElasticSearch.
Solution 1:
From what I've learnt, the third parameter for the .replace() parameter takes the count of the number of times you want to replace the old substring with the new substring, so instead just remove the third parameter since you don't know the number of times the new line exists.
new_f = f[keep_col].replace('\\n',' ')
This should help
Post a Comment for "How To Remove Newline In Pandas Dataframe Columns?"