02-11-2022 11:47 AM
I have to remove new line character from entire column of a dataframe , I tried with regex_replace but its not working.
Help me on this.
02-15-2022 12:19 AM
Hi @Shriram S ,
Please try the following code:
import pandas as pd df=pd.read_csv("xyz.csv") col = ["columns_of _the _dataframes_that_needs_modification"] new_df = df[col].replace('\\n',' ', regex=True) new_df.to_csv("newFile.csv", index=False)
View solution in original post
02-11-2022 01:57 PM
Hi @Shriram S ! My name is Kaniz, and I'm the technical moderator here. Great to meet you, and thanks for your question! Let's see if your peers in the community have an answer to your question first. Or else I will get back to you soon. Thanks.
02-12-2022 10:46 AM
Yeah , thank you .
02-13-2022 02:25 PM
Could you please provide example of your data and the code you've tried?
03-16-2022 07:07 AM
Hi @Shriram S , Did the above provided code work for you?
never-displayed