Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- url = 'https://en.wikipedia.org/wiki/World_population'
- table = pd.read_html(url)
- new_table = table[4]
- new_table = new_table.set_index('Rank')
- new_table = new_table.drop('Source(official or UN)', axis=1)
- new_table = new_table.drop('% of world', axis=1)
- print(new_table)
- new_table.to_html('C:/Users/eli/Desktop/simple.html')
- # another way is with BeautifulSoup
Add Comment
Please, Sign In to add comment