Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97771

Panda DataFrame on scraped football scores

$
0
0

New to Python and web scraping. I am trying to import live college football scores via BeautifulSoup (from ESPN) into a Panda DataFrame. I have searched high and low and can't seem to get the imported scores to format correctly.

Once I have it in a Dataframe, I will then import the results into Excel.

Here's what I have so far. The results are in one column all the teams followed by all the scores.


from bs4 import BeautifulSoup
from selenium import webdriver
import pandas as pd


driver = webdriver.Chrome(executable_path=r'C:\Users\Jims Maximus Hero\Desktop\chromedriver.exe')
driver.get("https://www.espn.com/college-football/scoreboard/_/group/80/year/2019/seasontype/2/week/11")

html = driver.page_source
soup = BeautifulSoup(html, "lxml")

for tag in soup.find_all("span", {"class":"sb-team-short"}):
    print (tag.text)

for tag in soup.find_all("td", {"class":"total"}):
    print (tag.text)

Thanks for any help


Viewing all articles
Browse latest Browse all 97771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>