swar / nba_api

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

[Bug]: Road Games not returning from cumestatsplayergames when using "location_nulalble" parameter #418

Open GargantuanB opened 5 months ago

GargantuanB commented 5 months ago

NBA API Version

1.4.1

Issue

I've been attempting to pull player stats for road games using the cumestatsplayergame endpoint. However, whenever I attempt to build a dataframe with just road data, it comes back empty. I've attempted the exact same call with home games with no issue.

When I make a call without the "location_nullable" parameter, all games return, including home and road games.

I can still get the data I need without using the location parameter, but I wanted to report this in case there is an issue within the API

Code

Fails to return any data:

awayLog = cumestatsplayergames.CumeStatsPlayerGames( player_id=203999, league_id='00', season='2022-23', season_type_all_star='Regular Season', location_nullable='Road' ).get_data_frames()[0][:100]

returns data without issue:

homeLog = cumestatsplayergames.CumeStatsPlayerGames( player_id=203999, league_id='00', season='2023-24', season_type_all_star='Regular Season', location_nullable='Home' ).get_data_frames()[0][:100]

rsforbes commented 5 months ago

@GargantuanB - I was successful in replicating your results. Unfortunately, the issue exists within the NBA API service itself; unrelated to the library.

When I looked at the results, both the home and road games all appear as road games regardless of actual location. I jumped on the NBA site and even they are throwing a 400 when attempting to use a location. Notice the malformed URL note the "Away%20%20" values within Location.

`https://stats.nba.com/stats//cumestatsplayergames?LeagueID=00&Location=Away%20%20&Outcome=&Season=2023&SeasonType=Regular%20Season&PlayerID=1641749&VsConference=&VsDivision=&VsTeamID=0`

So we have the following:

  1. home returns all games as road games.
  2. road returns nothing
  3. away, used on the NBA's website, returns 400.

I've tagged this as endpoint: third-party issue, indicating that it is beyond our control to resolve, and will leave it open should someone run into the same situation.