Skip to content

feat: support current-team filtering in load_teams - #63

Open
ArtMoreno wants to merge 1 commit into
nflverse:mainfrom
ArtMoreno:feat/load-teams-current
Open

feat: support current-team filtering in load_teams#63
ArtMoreno wants to merge 1 commit into
nflverse:mainfrom
ArtMoreno:feat/load-teams-current

Conversation

@ArtMoreno

Copy link
Copy Markdown

load_teams() currently returns historical and alternate team abbreviations and does not accept the current argument available in nflreadr. Add current: bool = True, matching the R implementation's default and its use of the existing team_abbr_mapping values.

Closes #48.

With the live team dataset checked September 9, 2026:

import nflreadpy as nfl

nfl.load_teams()               # 32 rows: standardized current teams
nfl.load_teams(current=True)   # same result
nfl.load_teams(current=False)  # 36 rows: original unfiltered behavior

The current dataset's excluded abbreviations are LAR, OAK, SD, and STL; the standardized Rams abbreviation is LA. Filtering derives from the bundled mapping, not a hardcoded list or team count. The downloaded/cached frame is preserved for callers requesting all entries.

Changes

  • src/nflreadpy/load_teams.py: optional filter using the existing mapping; document the argument and default.
  • tests/test_integration.py: regression coverage for default, explicit true, and false; check row order, metadata, and preservation of the unfiltered frame.
  • CHANGELOG.md: explain the new default and the current=False migration path.

Validation

Native Windows, Python 3.11.15; locked development dependencies.

  • New regression: all three cases fail against original main and pass with the change.
  • python -m pytest tests -v: 51 passed, including live-data integration tests.
  • Separate live-data check: 32 default rows, 36 unfiltered rows; repeated unfiltered calls retain the complete dataset.
  • Ruff lint and formatting on changed Python files: pass.
  • MkDocs build: pass; the existing utils_date.py missing-annotation warning remains.
  • git diff --check: pass.
  • mypy src: 5 errors in unchanged datasets.py and utils_date.py. Repeating mypy with the original load_teams.py produces the same 5 errors; no new errors from this patch.

Base: c54316e16fb6cbbfbc52ed2a9c07fca070a0c636.

No overlapping PR appeared in the all-state current load_teams search. This deliberately changes the no-argument default to match nflreadr; callers needing historical/alternate rows should pass current=False.

Prepared with Codex assistance; all reported tests were run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement current as an parameter to load_teams()

1 participant