Thank you for the helpers !
I am scraping a table of data about covid19 and push it into a pandas data frame , it was working until this morning .
That the code :
JavaScript
x
17
17
1
import pandas as pd
2
import requests
3
from bs4 import BeautifulSoup
4
5
6
url = 'https://www.worldometers.info/coronavirus/'
7
8
req = requests.get(url)
9
10
page = BeautifulSoup(req.content, 'html.parser')
11
12
table = page.find_all('table',id="main_table_countries_today")[0]
13
14
print(table)
15
16
df = pd.read_html(str(table))[0]
17
This morning I starting to get the next error :
JavaScript
1
2
1
ValueError: No tables found matching pattern '.+'
2
Can you please help me figure it out ?
Advertisement
Answer
Try changing the last line to: df = pd.read_html(str(table), displayed_only=False)[0]
The table header at the url has changed its style attribute to style=”width:100%;margin-top: 0px !important;display:none;”. Previously it did not have the ‘display’ tag set.