Advertisement
qharr

Untitled

May 10th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import requests
  3. import pandas as pd
  4.  
  5. r = requests.get("https://web.archive.org/web/20140528015357/http://eciresults.nic.in/statewiseS26.htm?st=S26")
  6. soup = BeautifulSoup(r.content,"lxml")
  7. table = pd.read_html(str(soup.select_one('#divACList table')))[0]
  8. table.columns = table.iloc[2]
  9. table = table.iloc[3:].dropna(how = 'all', axis = 0)
  10. table.reset_index(inplace=True, drop=True)
  11. table.columns.names = ['Index']
  12. print(table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement