Curt Beck
1 min readJul 5, 2020

--

That's strange, I just tested the code again, and it worked for me.

One thing we can do is try it in piecemeal:

Here is a sample that just scrapes the total ESG score for Microsoft:

from bs4 import BeautifulSoup

import pandas as pd

import requests

import ipywidgets as widgets

from ipywidgets import interact

web_data = requests.get('https://finance.yahoo.com/quote/MSFT/sustainability?p=MSFT').text

soup = BeautifulSoup(web_data, 'html.parser')

esg_score = soup.find('div', {'class':'Fz(36px) Fw(600) D(ib) Mend(5px)'})

print(esg_score.text)

Try testing that out. It should output an ESG score of 16.

--

--

Curt Beck
Curt Beck

Written by Curt Beck

Stumbled into a data-centric role several years ago and have not looked back! Passionate about leveraging technology to uncover answers and improve the world.

Responses (1)