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

Team Abbreviations don't match between imports #87

Open
2 tasks done
darkhark opened this issue Jun 26, 2024 · 1 comment
Open
2 tasks done

Team Abbreviations don't match between imports #87

darkhark opened this issue Jun 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@darkhark
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Have you installed the latest development version of the package(s) in question?

  • I have installed the latest development version of the package.

If this is a data issue, have you tried clearing your nflverse cache?

I have cleared my nflverse cache and the issue persists.

What version of the package do you have?

0.3.1

Describe the bug

The weekly stats and schedule stats use different team abbreviations for teams that moved. For example, in 1999, the chargers are SD in the schedule data, but are LAC in the weekly stats data. There may be more (like STL and LA) but I found this while attempting to merge the two datasets and noticed the chargers data was missing in 1999 - 2016.

Reprex

import nfl_data_py as nfl

weekly_df = nfl.import_weekly_data([1999, 2017])
schedule_df = nfl.import_schedules([1999, 2017])

print('Weekly Data')
print(weekly_df[weekly_df['opponent_team'] == 'LAC'][['season', 'opponent_team']])
print('-------------------')
print('Schedule Data')
print(schedule_df[schedule_df['away_team'] == 'LAC'][['season', 'away_team']])

Expected Behavior

I would expect all team abbreviations to be consistent between imports. Ideally, they would all use the team name at the time.

nflverse_sitrep

NA

Screenshots

No response

Additional context

This may be the desired outcome when this was written, but even if it is, it would be useful to have a parameter or something that can convert the team names to either what they were at the time or to the most recent names

@alecglen
Copy link
Collaborator

This is the case for SD -> LAC, STL -> LA, and OAK -> LV. It's not really a bug, it's just how the data is presented in the nflverse sources.

I've also gotten caught up on this before though, and I like the idea of a parameter to toggle the updates. I'll plan on adding that at some point.

Here's a quick conversion for anyone needing it in the meantime:

for col in ("recent_team", "opponent_team"):
    weekly_df.loc[(weekly_df[col] == "LA") & (weekly_df["season"] <= 2015), col] = "STL"
    weekly_df.loc[(weekly_df[col] == "LAC") & (weekly_df["season"] <= 2016), col] = "SD"
    weekly_df.loc[(weekly_df[col] == "LV") & (weekly_df["season"] <= 2019), col] = "OAK"

@alecglen alecglen changed the title [BUG] Tea Abbreviations don't match between imports Team Abbreviations don't match between imports Sep 20, 2024
@alecglen alecglen added the enhancement New feature or request label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants