Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't web scrap html table beautiful soup

Trying to scrap IPO table data from here:
https://www.iposcoop.com/last-12-months/

Here is my code:

import requests
from bs4 import BeautifulSoup
import pandas as pd

url = 'https://www.iposcoop.com/last-12-months/'
page = requests.get(url)
soup = BeautifulSoup(page.text, 'lxml')
table1 = soup.find("table",id='DataTables_Table_0')
table1_data = table1.tbody.find_all("tr")
table1

However, table1 is NonType. Why is that? Any solution? I have read related issues, iframe doesn’t seem to be the answer.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can grab table data using pandas

import pandas as pd
import requests 
from bs4 import BeautifulSoup

url='https://www.iposcoop.com/last-12-months'
req=requests.get(url).text
soup=BeautifulSoup(req,'lxml')
table=soup.select_one('.standard-table.ipolist')
table_data =pd.read_html(str(table))[0]
print(table_data)

Output:

                 Company  Symbol  ...   Return SCOOP Rating
0                                         Akanda Corp.    AKAN  ...   85.00%          S/O     
1    The Marygold Companies, Inc. (aka Concierge Te...    MGLD  ...    9.50%          S/O     
2                            Blue Water Vaccines, Inc.     BWV  ...  343.33%          S/O     
3            Meihua International Medical Technologies    MHUA  ...  -33.00%          S/O     
4                                        Vivakor, Inc.    VIVK  ...  -49.40%          S/O     
..                                                 ...     ...  ...      ...          ...     
355                Khosla Ventures Acquisition Co. III    KVSC  ...   -2.80%          S/O     
356           Dragoneer Growth Opportunities Corp. III    DGNU  ...   -2.40%          S/O     
357                                        Movano Inc.    MOVE  ...  -43.60%          S/O     
358         Supernova Partners Acquisition Company III  STRE.U  ...    0.10%          S/O     
359                           Universe Pharmaceuticals     UPC  ...  -74.00%          S/O     

[360 rows x 10 columns]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading