Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FBref] German League 2122: Length of values (53) does not match length of index (54) #354

Open
LuisEnriqueKaiser opened this issue Sep 6, 2023 · 2 comments
Labels
bug Something isn't working FBref Issue or pull request related to the FBref scraper good first issue Good for newcomers

Comments

@LuisEnriqueKaiser
Copy link

Hello everyone,

I want to scrape match data with the fbref.read_team_match_stats() function and it does work good for all leagues except for the german league. More specifically, it does not work for the 21-22 season.

My python version is 3.11 and I am using the latest soccerdata distribution.
I will attach a screenshot of the error message and of my code.

Screenshot 2023-09-06 at 10 06 59 Screenshot 2023-09-06 at 10 08 11

Kind regards

@probberechts
Copy link
Owner

It looks like an inconsistency in the FBref website. The "match_report" stat is missing for some game of some team in the season. You can try to make the following snippet a bit more robust:

df_table["Match Report"] = [
mlink.xpath("./a/@href")[0]
if mlink.xpath("./a") and mlink.xpath("./a")[0].text == "Match Report"
else None
for mlink in html_table.xpath(".//td[@data-stat='match_report']")
]

@probberechts probberechts added bug Something isn't working good first issue Good for newcomers FBref Issue or pull request related to the FBref scraper labels Sep 6, 2023
@probberechts probberechts changed the title FBRef German League 2122: Length of values (53) does not match length of index (54) [FBref] German League 2122: Length of values (53) does not match length of index (54) Sep 6, 2023
@TimelessUsername
Copy link

TimelessUsername commented Oct 10, 2023

Similar issue with WhoScored, I'm currently trying to find out why 21-22 season fails to match the league...

Edit:

As the error is; KeyError: "[('ARG-Liga Profesional', '2122')] not in index", while input years are of the form [15, 16, ... , 20, 21, 22, 23], the string conversion logic seems to fail and thus fail to match the year. The 2122 form needs to be converted to 2022, I recon.

Edit2:

Various issues with different input formats too, the logic needs a bit of work I think.

Edit3: Appears whoscore doesnt have some of the years during the virus...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FBref Issue or pull request related to the FBref scraper good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants