-1

The website is https://en.wikipedia.org/wiki/List_of_national_capitals_by_population I'm trying to scrape the table with the national capitals

base_site = "https://en.wikipedia.org/wiki/List_of_national_capitals_by_population"

tables = pd.read_html(base_site)

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)>

Why is this error message popping up? Also, there is more to the error message.

1 Answers1

0

Try this:

import pandas as pd
import io
import requests

url = "https://en.wikipedia.org/wiki/List_of_national_capitals_by_population"
s = requests.get(url).content
df = pd.read_csv(io.StringIO(s.decode('utf-8')))
Baraa Zaid
  • 362
  • 1
  • 9