eddwebster / football_analytics

📊⚽ A collection of football analytics projects, data, and analysis by Edd Webster (@eddwebster), including a curated list of publicly available resources published by the football analytics community.
https://www.eddwebster.com
1.85k stars 261 forks source link

AttributeError: 'NoneType' object has no attribute 'text' #1

Closed marclelamy closed 2 years ago

marclelamy commented 3 years ago

In FBref Web Scraping and Parsing - 2020-2021 Season Only part 1.5.2.2 there's a

`AttributeError Traceback (most recent call last)

in 14 15 ### Premier League ---> 16 df_fbref_team_premierleague_2021_raw = get_team_data('https://fbref.com/en/comps/9/10728/','/Premier-League-Stats') 17 df_fbref_team_premierleague_2021_raw['league_name'] = 'Premier League' 18 df_fbref_team_premierleague_2021_raw['league_country'] = 'England' in get_team_data(top, end) 3 df1 = frame_for_category_team('stats',top,end,stats3) 4 df2 = frame_for_category_team('keepers',top,end,keepers3) ----> 5 df3 = frame_for_category_team('keepersadv',top,end,keepersadv2) 6 df4 = frame_for_category_team('shooting',top,end,shooting3) 7 df5 = frame_for_category_team('passing',top,end,passing2) in frame_for_category_team(category, top, end, features) 75 url = (top + category + end) 76 player_table, team_table = get_tables(url) ---> 77 df_team = get_frame_team(features, team_table) 78 return df_team in get_frame_team(features, team_table) 53 for f in features_wanted_squad: 54 cell = row.find("td",{"data-stat": f}) ---> 55 a = cell.text.strip().encode() 56 text=a.decode("utf-8") 57 if(text == ''): AttributeError: 'NoneType' object has no attribute 'text'`
eddwebster commented 3 years ago

Thanks for raising this. From a quick observation, this is an error is from the code that I took from Parth Athale's 'Scrape-FBref-data' library here: https://github.com/parth1902/Scrape-FBref-data. This is most likely due to changes in the FBref website breaking the scraper.

I will take a look to see if Parth has updated his code to fix this. Thanks