0

I have this dataframe parsed from a web page using web-scraping. Libraries used are, bs4(BeautifulSoup), pandas, requests and urllib. The table has to be downloaded in csv for data visualisation in tableau afterwards. So without affecting any of the rows and columns, I want to remove "\n" from the dataframe. Any help will be appreciatenter image description hereed.

enter image description here

help-ukraine-now
  • 3,850
  • 4
  • 19
  • 36

2 Answers2

0

You could do something like this:

rank_details["Pos"] = Pos.text.strip('\n')
Daniel
  • 391
  • 1
  • 12
0

I think your question is answered within this question.

More precisely,

dataFrame.replace('\n', '', regex=True)

should do it for you. Please note that after this, you may also need to strip the strings from leading and trailing whitespaces, and also to convert some of the columns (seemingly Pos should be an integer), with the astype method.

borosdenes
  • 73
  • 7