Is there a method that converts the selected table into a data frame right away with Beautiful Soup?

Asked 2 years ago, Updated 2 years ago, 70 views

I want to scratch a table on a website and convert it into a data frame, or save it as an Excel file right away Is there a function that converts the table selected by bs4 into a data frame right away? I looked it up and found a way to connect them one by one I'm asking this question just in case you don't have it

html=driver.page_source
bsoup=BeautifulSoup(html,'html.parser')
table=bsoup.select('table')

python beautifulsoup dataframe

2022-09-20 15:32

1 Answers


dfs = pd.read_html(str(bsoup.select('table')))
# # df = dfs[0]


2022-09-20 15:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.