Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Ways to Scrape Table | Tables
Web Scraping with Python
course content

Зміст курсу

Web Scraping with Python

Web Scraping with Python

1. HTML Files and DevTools
2. Beautiful Soup
3. CSS Selectors/XPaths
4. Tables

book
Ways to Scrape Table

There are a lot of different ways to scrap tables. The method depends on the structure of the table.

You can apply string methods. As you remember, the function find_all() looks through a tag’s descendants and retrieves all descendants that match the parameter. If we apply it to the tag <tr> the result will be a list of contents of each <tr> tag.

1
rows = html.find_all('tr')
copy

You can also do it using XPath:

python

Then we can clean the data and convert it to the DataFrame. This method can be useful if the table has a complex and confusing structure.

question mark

To get tags we can use:

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 4. Розділ 2
Ми дуже хвилюємося, що щось пішло не так. Що трапилося?
some-alt