Analyzing Nba Stats

by KevinGastelum

data

Fetches and processes NBA player and team statistics. Use when the user wants to analyze basketball data for the sports picker model.

Skill Details

Repository Files

1 file in this skill directory


name: analyzing-nba-stats description: Fetches and processes NBA player and team statistics. Use when the user wants to analyze basketball data for the sports picker model.

Analyzing NBA Stats

When to use this skill

  • User asks for "player props" or "recent form" for NBA players.
  • User wants to analyze "box scores" or "advanced metrics" (PER, TS%, Usage).
  • Integrating new NBA data sources into the model component.

Workflow

  • Source Selection: Decide between nba_api (Python wrapper for stats.nba.com) or external scraping if needing prop betting odds.
  • Normalization: Map Player Names to IDs consistently. Handle "J. Brown" vs "Jaylen Brown".
  • Data Frame Creation: Always load data into a Pandas DataFrame for analysis.
  • Feature Engineering: Calculate rolling averages (last 5 games, last 10 games) as these are crucial for betting models.

Instructions

1. Using nba_api (Python)

The model directory is likely where this code lives.

from nba_api.stats.endpoints import playergamelog
import pandas as pd

def get_player_last_n_games(player_id, n=5):
    # Season '2023-24' needs to be dynamic
    log = playergamelog.PlayerGameLog(player_id=player_id, season='2024-25') 
    df = log.get_data_frames()[0]
    return df.head(n)

2. Key Metrics for Betting

Focus on these stats for prop bets:

  • PTS, REB, AST: Standard props.
  • Minutes Played: High correlation with output.
  • USG% (Usage Rate): Good for predicting high-scoring games.

3. Rate Limiting

stats.nba.com is strict.

  • Add user-agent headers if making raw HTTP requests.
  • Implement delays between requests in loops.

Resources

Related Skills

Xlsx

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

data

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Clickhouse Io

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

datacli

Analyzing Financial Statements

This skill calculates key financial ratios and metrics from financial statement data for investment analysis

data

Data Storytelling

Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.

data

Kpi Dashboard Design

Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.

designdata

Dbt Transformation Patterns

Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.

testingdocumenttool

Sql Optimization Patterns

Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.

designdata

Anndata

This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.

arttooldata

Xlsx

Spreadsheet toolkit (.xlsx/.csv). Create/edit with formulas/formatting, analyze data, visualization, recalculate formulas, for spreadsheet processing and analysis.

tooldata

Skill Information

Category:Data
Last Updated:1/18/2026