Trouble formatting data with bs4 and pandas

Solution 1:

Here is the code:

prices = data.find_all(attrs={"class":"no-wrap", "class" : "td-price price text-right pl-0"})
prices = [price.text.replace("\n","").strip() for price in prices]

that second line will reiterate through the prices list and remove all the \n (which are line breaks) and .strip will remove any spaces at the start or end of your items.