Big 5 league player stats for fbref#69
Big 5 league player stats for fbref#69andrewRowlinson wants to merge 3 commits intoprobberechts:masterfrom
Conversation
Added read_big5_season_stats to rbref.py for efficiently reading the data from the big five leagues (England, Italy, France, Germany, Spain).
|
Fbref also has pages for the big five leagues that allow you to more efficiently get player data when you want multiple leagues. I added a method here to get this data, but it doesn't fit neatly into the existing class as it ignores the leagues attribute. I have tried to keep the interface and results similar to the other methods. |
|
Thanks for your PR! The Additionally, you could then use the page for the top-5 leagues if the user requested data from (multiple) of the top-5 leagues, but the benefit would be more limited. This should not be a separate (public) function though. It should be integrated in the |
…filter for the selected leagues. Amended the config to add the big-5.
Unfortunately, the player stats for these new pages (e.g. https://fbref.com/en/comps/9/stats/Premier-League-Stats) wouldn't be loaded by the existing functions, as it only currently loads the top table containing squad/ opponent stats and not the player statistics underneath. I think you can get around this using Selenium to load the whole page, unless I am missing a simpler way?
I have amended the |
I've only quickly looked at this in the browser, but it seems that the tables are actually there with all the data. They are just commented out in the HTML. Some javascript then makes them visible. I think a simple |
FBRef now has a single page for each league/season where player stats can be obtained for each player in the league (e.g., https://fbref.com/en/comps/9/stats/Premier-League-Stats). Therefore, it is no longer required to visit the page of each individual team in a league. The fbref.read_team_season_stats method now uses 15-20x less requests, leading to a large speed-up. See also #69 Co-authored-by: Andrew Rowlinson <rowlinsonandy@gmail.com>
Added read_big5_season_stats to rbref.py for efficiently reading the data from the big five leagues (England, Italy, France, Germany, Spain).