Created
May 4, 2017 15:06
-
-
Save ericabell/9c4c52ab51a801303e49d0348b47289f to your computer and use it in GitHub Desktop.
pooya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
import requests | |
from bs4 import BeautifulSoup | |
page = requests.get('http://www.politico.com/2012-election/results/president/wisconsin/') | |
soup = BeautifulSoup(page.text, "html.parser") | |
for body in soup("tbody"): | |
body.unwrap() | |
tables = pandas.read_html(str(soup), flavor="bs4") | |
pandas.set_option('display.max_rows', len(tables[1])) | |
print (tables[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment