0
import requests
import pandas as pd
import html5lib
url = 'https://stats.nba.com/leaders/?Season=2009- 
10&SeasonType=Regular%20Season'
html = requests.get(url).contententer 
df_list = pd.read_html(html)
df = df_list[-1]
print(df)
df.to_csv('my data.csv')

And i get" ValueError: No tables found", i think there is something wrong with my link"

  • What line is the error on? – clubby789 Oct 13 '19 at 00:42
  • Traceback (most recent call last): File "test2.py", line 6, in – Hieu NGuyen Oct 13 '19 at 00:47
  • shouldn't that be 'content' ? Also, itlooks like that url is not returning you a table which is what pd.read_html() is expecting. You need to take a better look at the webpage structure and accordingly write your webscrapping code. – san Oct 13 '19 at 01:19
  • You're not the first one encountering this problem. The issue here is that the content of the page is not present yet when you request it, probably beacause it's loaded through some javascript code afterwards. I'd suggest for you to use the `selenium` module, as was already pointed out [here](https://stackoverflow.com/questions/45448994/wait-page-to-load-before-getting-data-with-requests-get-in-python-3). – Michele Bastione Oct 13 '19 at 16:56

0 Answers0