I'm trying to scrape a web page for the table of countries and their areas.
My code compiles and runs but only outputs the top two rows, when I want them all.
I thought the problem may lie with .head(), so I played around with it passing numbers and leaving it out all together, but I can't get it to print more than two.
Any help would be appreciated!
from gazpacho import get, Soup
import pandas as pd
url = "https://www.cia.gov/library/publications/the-world-factbook/rankorder/2147rank.html"
response = get(url)
soup = Soup(response)
df0 = pd.read_html(str(soup.find('table')))[0]
print(df0[['Rank', 'Country', '(SQ KM)']].head())