Questions tagged [nba-api]

nba-api is an python API client to access the APIs for NBA.com. Support for pandas and built with Jupyter Notebooks in mind, though both are optional. Questions on SO should be focussed on implementing the package and working with the data that's available.

A python API Client package to access the APIs for NBA.com.

Useful Links

34 questions
2
votes
1 answer

Collecting specific player info from NBA API

I'm looking to collect specific data using an NBA API in this example I'm attempting to retrieve a random player's full name & height from a normalized dictionary from nba_api.stats.static import players from nba_api.stats.endpoints import…
dehnm
  • 101
  • 1
  • 7
1
vote
0 answers

nba_api timeouts when run with GitHub workflow

I use npa_api requests to get play-by-play data for some games. The request works on my personal computer with python environment: leaguegamefinder.LeagueGameFinder(player_or_team_abbreviation='T',date_from_nullable = Today,date_to_nullable = Today,…
LouHeb
  • 11
  • 1
1
vote
1 answer

How to combine every 2 rows into 1 row

I am trying to fix this NBA game detail table. Every two rows are the same game(GAME_ID) in the table. I want the two rows to be in one row so that the home team and the away team's data will be on the same row.
Takomochi
  • 13
  • 1
  • 6
1
vote
1 answer

Traceback error when I am attempting to grab all box scores

import pandas as pd import requests headers = { 'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'x-nba-stats-token': 'true', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6)…
1
vote
1 answer

Connection Timeout error is thrown while using leaguegamefinder of nba_api.stats.endpoints library

What I tried: from nba_api.stats.static import teams from nba_api.stats.endpoints import leaguegamefinder import pandas as pd nba_teams = teams.get_teams() def one_dict(list_dict): keys = list_dict[0].keys() out_dict = {key:[] for key in…
0
votes
1 answer

Resolving read timeout error while using nba_api

I am trying to get career stats and awards from nba_api, but I'm getting a read timeout error. I'm using the following as a baseline for a project. from nba_api.stats.static import players from nba_api.stats.endpoints import playercareerstats from…
wnasi3
  • 1
  • 1
0
votes
0 answers

Having Trouble extracting data from nba_api pacakge

from nba_api.stats.endpoints import commonplayerinfo, leagueleaders import pandas as pd # Function to retrieve data from the NBA API and convert it to a DataFrame def get_data_from_api(endpoint, params): data = endpoint(**params) headers =…
Awadis
  • 1
0
votes
0 answers

is it possible to get boxscore data using boxscore enpoint for seasons earlier than 2019-2020?

I am able to use LeagueGameFinder to get get game ids that can be passed to Boxscore to get live box score info for seasons 2019-2023. However, I get invalid responses for data prior to 2019. Anyone know why? for example I use the following code to…
0
votes
0 answers

Trying to pull NBA_API playerlogs and continue to get the following error and unable to pull active player game logs

Here is the JSON error I am receiving. Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: nba_api in /usr/local/lib/python3.8/dist-packages (1.1.14) Requirement already…
0
votes
0 answers

Unexepcted empty JSON in NBA API

I am trying to use the NBA API and I have a big problem with returning invalid JSON strings. I am using a code from nba_api.stats.static import players from nba_api.stats.endpoints import shotchartdetail player_dictionary =…
0
votes
0 answers

Attempting to use nba-api to fetch the boxscore and player stats for the all star game

I'm trying to use the nba-api stats scoreboardv2 class to fetch the All-Star 2022 game results, however it looks like the All Star game isn't registered as a game. I tried fetching the scoreboard for the date of the all star game: scoreboard =…
0
votes
1 answer

How to pull player game logs from multiple seasons using nba_api?

I am trying to get familiar with nba_api package for python. I am attempting to pull player data from the past two seasons. However, I am only able to get all of the seasons or just one season. First, I saw I could collect the game logs from an…
0
votes
1 answer

How to get stats + games of a specific date using data.nba.net?

I am currently playing around with NBA API, and I want to be able to look at parts of games(score, period, etc.) that happened on a specified date. I want the output of what "https://data.nba.net/prod/v1/today.json" would return on any day during…
0
votes
1 answer

Changing Column Data Type Pandas

I'm working on an NBA Project and I am using an API to get data from Basketball Reference. The data type "SEASONS" with the dataframe shown below is as a date time object and I want to change it to a String but I'm unable to. What Am i doing wrong?…
Naman Nagelia
  • 49
  • 1
  • 6
0
votes
2 answers

Webscrape NBA stats nba_api endpoints

I am trying to scrape the data from NBA stats, specifically the team's boxscore. I am looking for the nba_api endpoint for this page so that i can scrape the data. How can I find the endpoint?
Takomochi
  • 13
  • 1
  • 6
1
2 3