Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 395 Bytes

scraping_tables.md

File metadata and controls

13 lines (8 loc) · 395 Bytes

Scraping table data from sites

Pretty straight forward with the read_html method.

import pandas as pd

sandp = pd.read_html("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies")

print(sandp) # will print out how many tables on the site

print(sandp[0]) # will print first table