swar / nba_api

An API Client package to access the APIs for NBA.com
MIT License
2.43k stars 524 forks source link

leaguegamefinder not properly using game_id_nullable parameter #255

Open Pyroblocks opened 2 years ago

Pyroblocks commented 2 years ago

Hey there, I've been having an issue trying to filter the leaguegamefinder module to only output a certain game ID. However, it seems to be ignoring the parameter entirely. Here's the code:

import pandas as pd

from nba_api.stats.endpoints import leaguegamefinder

gamefinder = leaguegamefinder.LeagueGameFinder(season_nullable="2021-22",game_id_nullable="0042100156",league_id_nullable='00')
games = gamefinder.get_data_frames()[0]

team1 = games.iloc[0,3]
score1 = games.iloc[0,9]
team2 = games.iloc[1,3]
score2 = games.iloc[1,9]

print(team1)
print(score1)
print(team2)
print(score2)

finalscore = team1 + " " + str(score1) + " - " + str(score2) + " " + team2
print(finalscore)

print(games.iloc[0:2,3:12])
#print(games.head())

And here's the output: image

As you can see, it's completely ignoring the game_id_nullable parameter, and is just operating as if it's not there. What can I do to fix this? Thank you!

RubenRuVito commented 2 years ago

Hi. Have you tried this method? List_of_DF = endpoints.BoxScoreSummaryV2(game_id='0042100156').get_data_frames()[0.....8] I think you could use it. because you get a lot of information from the game, which you can then use in other methods. I hope it serves you, greetings.