Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import requests
- import pandas as pd
- r = requests.get("https://web.archive.org/web/20140528015357/http://eciresults.nic.in/statewiseS26.htm?st=S26")
- soup = BeautifulSoup(r.content,"lxml")
- table = pd.read_html(str(soup.select_one('#divACList table')))[0]
- table.columns = table.iloc[2]
- table = table.iloc[3:].dropna(how = 'all', axis = 0)
- table.reset_index(inplace=True, drop=True)
- table.columns.names = ['Index']
- print(table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement