Removing backslashes from values in a Pandas dataframe
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Underwater World
--
Chapters
00:00 Question
00:42 Accepted answer (Score 12)
00:55 Answer 2 (Score 0)
01:10 Thank you
--
Full question
https://stackoverflow.com/questions/5286...
Accepted answer links:
[replace]: https://pandas.pydata.org/pandas-docs/st...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pandas #dataframe #replace #escaping
#avk47
    --
Music by Eric Matyas
https://www.soundimage.org
Track title: Underwater World
--
Chapters
00:00 Question
00:42 Accepted answer (Score 12)
00:55 Answer 2 (Score 0)
01:10 Thank you
--
Full question
https://stackoverflow.com/questions/5286...
Accepted answer links:
[replace]: https://pandas.pydata.org/pandas-docs/st...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pandas #dataframe #replace #escaping
#avk47
ACCEPTED ANSWER
Score 12
You can use replace
df = df.replace(to_replace= r'\\', value= '', regex=True)
ANSWER 2
Score 0
I prefer to use the string API for each column.
for col in df:
    df[col] = df[col].str.replace(r'\\','')