โ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)
โ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?
โ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)
โ03-16-2022 07:07 AM
Hi @Shriram Sโ , Did the above provided code work for you?
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group