An easy-to-use wrapper for nba_api to easily find data for a player, game, team, or season
Project description
NBAStatPy
Overview
A simple, easy-to-use wrapper for the nba_api package to access NBA data for players, games, teams, and seasons.
Quick Start
from nbastatpy.player import Player
# Create a player object
player = Player("Giannis", season="2023", playoffs=True)
# Get data
awards = player.get_awards()
stats = player.get_career_stats()
Main Classes
- Player - Access player stats, career data, and awards
- Game - Get boxscores, play-by-play, and game details
- League - Query league-wide stats, lineups, and tracking data
- Team - Retrieve team rosters, stats, and splits
Standalone Usage
from nbastatpy.standardize import standardize_dataframe
df = standardize_dataframe(df, data_type='player')
MCP Integration (AI Assistant Tools)
NBAStatPy includes a Model Context Protocol (MCP) server that allows AI assistants like Claude to access NBA data directly.
Available Tools
| Tool | Description |
|---|---|
get_player_salary |
Get player salary data by name |
get_player_game_logs |
Get recent game logs for a player |
get_player_career_stats |
Get season-by-season career statistics |
get_player_play_type_stats |
Get play type (synergy) stats for a player |
get_player_tracking_stats |
Get tracking stats (drives, touches, etc.) |
get_league_leaders |
Get league leaders for any stat category |
get_team_recent_games |
Get recent games for a team |
get_team_play_type_stats |
Get play type stats for a team |
get_team_tracking_stats |
Get tracking stats for a team |
get_recent_games_summary |
Get summary of recent NBA games |
get_recent_games_player_stats |
Get player stats from recent games |
Claude Code Integration
Add to your Claude Code MCP settings (~/.claude/settings.json):
{
"mcpServers": {
"nbastatpy": {
"command": "uvx",
"args": ["--from", "nbastatpy", "nbastatpy-mcp"]
}
}
}
Or with pip:
{
"mcpServers": {
"nbastatpy": {
"command": "python",
"args": ["-m", "nbastatpy.mcp.server"]
}
}
}
Running the MCP Server Manually
# With uvx (recommended)
uvx --from nbastatpy nbastatpy-mcp
# With uv
uv run python -m nbastatpy.mcp.server
# With pip install
python -m nbastatpy.mcp.server
Installation
Pip
pip install nbastatpy
UV
uv add nbastatpy
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbastatpy-0.3.0.tar.gz.
File metadata
- Download URL: nbastatpy-0.3.0.tar.gz
- Upload date:
- Size: 203.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f68cb5be0a7efa5f608b31b3970334a930f7d0737a40ae7f6b96ee23391287fb
|
|
| MD5 |
2529a38a160ff6d63aa518476c097805
|
|
| BLAKE2b-256 |
42df693de18fc495310e044fd08a0d80adf0b2ac5df76032d354d5be36825808
|
Provenance
The following attestation bundles were made for nbastatpy-0.3.0.tar.gz:
Publisher:
publish.yml on aberghammer-analytics/NBAStatPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbastatpy-0.3.0.tar.gz -
Subject digest:
f68cb5be0a7efa5f608b31b3970334a930f7d0737a40ae7f6b96ee23391287fb - Sigstore transparency entry: 834252417
- Sigstore integration time:
-
Permalink:
aberghammer-analytics/NBAStatPy@4909c304dfa4f800340c3b3e3937bfb43c5d3c9c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aberghammer-analytics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4909c304dfa4f800340c3b3e3937bfb43c5d3c9c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nbastatpy-0.3.0-py3-none-any.whl.
File metadata
- Download URL: nbastatpy-0.3.0-py3-none-any.whl
- Upload date:
- Size: 38.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
001c81e5cf8716a75507007b719ae7be03b468e045dd5d45be181baf4eefa29b
|
|
| MD5 |
734ea83202835855047a9a698c3e7240
|
|
| BLAKE2b-256 |
dd787991a931a6c874c4a7a58a3c32af129c37f460396bcce55e1238ce6ef692
|
Provenance
The following attestation bundles were made for nbastatpy-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on aberghammer-analytics/NBAStatPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbastatpy-0.3.0-py3-none-any.whl -
Subject digest:
001c81e5cf8716a75507007b719ae7be03b468e045dd5d45be181baf4eefa29b - Sigstore transparency entry: 834252420
- Sigstore integration time:
-
Permalink:
aberghammer-analytics/NBAStatPy@4909c304dfa4f800340c3b3e3937bfb43c5d3c9c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aberghammer-analytics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4909c304dfa4f800340c3b3e3937bfb43c5d3c9c -
Trigger Event:
workflow_dispatch
-
Statement type: