0

I am trying to parse a table (of prices) from a web and it is turning out a real struggle

here is the web

url='http://www.zonebourse.com/AEX-7959/composition/'

with bs4:

r = requests.get(url)
data = r.text
soup = BeautifulSoup(data,"html5lib")
tables =soup.find('table',id='ALNI4')

print tables

with html5lib:

df=pd.read_html(url)
print df

In both cases no tables found, could anyone help me parse the table or at least understand what is the problem?

ValueError: No tables found

I would like to discard the option of xml if possible, having problems to install so dont use at all.

Thank you in advance

JamesHudson81
  • 2,215
  • 4
  • 23
  • 42

2 Answers2

1

Seems you are looking for

url='http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/'
cs95
  • 379,657
  • 97
  • 704
  • 746
Prem
  • 11,775
  • 1
  • 19
  • 33
1

For some reason, the URL you are pointing to is wrong. I searched for what the URL actually is, and it is actually http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/.

I do not know why the URL is this weird.

If you make that edit, (url='http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/') your code should work correctly (though I did not test it myself!)

Hope it helps! Bonne chance!

cosinepenguin
  • 1,545
  • 1
  • 12
  • 21