[GH-ISSUE #218] Trouble season 2020 for Série A and MLS #44

Closed
opened 2026-03-02 15:55:17 +03:00 by kerem · 1 comment
Owner

Originally created by @sammekristensen on GitHub (Apr 21, 2023).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/218

I am trying to get the stats, specifically player season stats for various leagues including Brasilian Série A and MLS. I have implemented the leagues and everything is working except for the season 2020 (the 20-21 season) for these leagues. I have tried every combination of input for the season; '2020', '20-21', '2020-21', '20' but they either give me the wrong season or error:

try2.py 16 <module>
players = fbref.read_player_season_stats()

fbref.py 436 read_player_season_stats
df = _concat(players)

fbref.py 819 _concat
columns = reduce(lambda left, right: left.combine_first(right), all_columns)

TypeError:
reduce() of empty iterable with no initial value

When i print out fbref.read_seasons() with Major League Soccer i get:

league              season                                      url                         
Major League Soccer 1718    round-robin  /en/comps/22/2017/2017-Major-League-Soccer-Stats
                    1819    round-robin  /en/comps/22/2018/2018-Major-League-Soccer-Stats
                    1920    round-robin  /en/comps/22/2019/2019-Major-League-Soccer-Stats
                    2021    round-robin  /en/comps/22/2021/2021-Major-League-Soccer-Stats
                    2223    round-robin  /en/comps/22/2022/2022-Major-League-Soccer-Stats

It looks like there is no link for season 2020. Is there a way I can add it do the scripts?

Originally created by @sammekristensen on GitHub (Apr 21, 2023). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/218 I am trying to get the stats, specifically player season stats for various leagues including Brasilian Série A and MLS. I have implemented the leagues and everything is working except for the season 2020 (the 20-21 season) for these leagues. I have tried every combination of input for the season; '2020', '20-21', '2020-21', '20' but they either give me the wrong season or error: ``` try2.py 16 <module> players = fbref.read_player_season_stats() fbref.py 436 read_player_season_stats df = _concat(players) fbref.py 819 _concat columns = reduce(lambda left, right: left.combine_first(right), all_columns) TypeError: reduce() of empty iterable with no initial value ``` When i print out fbref.read_seasons() with Major League Soccer i get: ``` league season url Major League Soccer 1718 round-robin /en/comps/22/2017/2017-Major-League-Soccer-Stats 1819 round-robin /en/comps/22/2018/2018-Major-League-Soccer-Stats 1920 round-robin /en/comps/22/2019/2019-Major-League-Soccer-Stats 2021 round-robin /en/comps/22/2021/2021-Major-League-Soccer-Stats 2223 round-robin /en/comps/22/2022/2022-Major-League-Soccer-Stats ``` It looks like there is no link for season 2020. Is there a way I can add it do the scripts?
kerem closed this issue 2026-03-02 15:55:18 +03:00
Author
Owner

@probberechts commented on GitHub (Apr 21, 2023):

This is because FBref uses a different kind of season code for the MLS and Brasilian Serie A. For the Premier League, the current season is "2022-2023". For the MLS it is "2023". As none of the default-supported leagues use this kind of season code, I did not implement a parser for it. You'll have to adapt the season_code method in _common.py.

I'll close this issue, as it is about scraping leagues that are not officially supported. Nevertheless, if you have a fix feel free to create a pull request.

<!-- gh-comment-id:1517510347 --> @probberechts commented on GitHub (Apr 21, 2023): This is because FBref uses a different kind of season code for the MLS and Brasilian Serie A. For the Premier League, the current season is "2022-2023". For the MLS it is "2023". As none of the default-supported leagues use this kind of season code, I did not implement a parser for it. You'll have to adapt the `season_code` method in `_common.py`. I'll close this issue, as it is about scraping leagues that are not officially supported. Nevertheless, if you have a fix feel free to create a pull request.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#44
No description provided.