Python Forum
How to use BeautifulSoup4 with pandas series type of html data?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use BeautifulSoup4 with pandas series type of html data?
#4
It look like you try to put json data into BeautifulSoup.
What is the contented html_data?
For it to work it's has to be html.
from bs4 import BeautifulSoup

html_data = '''\
<!DOCTYPE html>
<html>
  <head>
    <title>Title of document</title>
  </head>
  <body>
    <p>Content of the document</p>
  </body>
</html'''

soup = BeautifulSoup(html_data, 'lxml')
print(soup.select('head > title')[0].text)
Output:
Title of document
Reply


Messages In This Thread
RE: How to use BeautifulSoup4 with pandas series type of html data? - by snippsat - Apr-25-2018, 09:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to scrape data from HTML with no identifiers pythonpaul32 2 974 Dec-02-2023, 03:42 AM
Last Post: pythonpaul32
  Beautifulsoup4 help samuelbachorik 1 1,393 Feb-05-2022, 10:44 PM
Last Post: snippsat
  Post HTML Form Data to API Endpoints Dexty 0 1,449 Nov-11-2021, 10:51 PM
Last Post: Dexty
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,759 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Cleaning HTML data using Jupyter Notebook jacob1986 7 4,263 Mar-05-2021, 10:44 PM
Last Post: snippsat
  Any way to remove HTML tags from scraped data? (I want text only) SeBz2020uk 1 3,548 Nov-02-2020, 08:12 PM
Last Post: Larz60+
  html data cell attribute issue delahug 5 3,247 May-31-2020, 09:18 AM
Last Post: delahug
  Extracting html data using attributes WiPi 14 5,672 May-04-2020, 02:04 PM
Last Post: snippsat
  How to crawl schema markup data type using scrapy? Nuwan16 1 3,137 Mar-31-2020, 03:42 PM
Last Post: stranac
  extrat data from a button html windows11 1 2,032 Mar-24-2020, 03:39 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020