swar / nba_api

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

[Bug]: Why are there decimals in fields that should not have decimals? For example, opponent points. #428

Closed SrijithVenkat closed 7 months ago

SrijithVenkat commented 7 months ago
Screenshot 2024-02-14 at 10 58 56 PM

NBA API Version

V1.4.1

Issue

Screenshot 2024-02-14 at 10 54 42 PM

Why are there decimals in fields that should not have decimals? For example, opponent points (26 in the picture) is a start, but there are a few more.

Even if my games are the last 2, for 2 whole numbers to equal out to 20.9 is simply not plausible. I also saw this trend when I set last_n_games="1". Is this simply user error on my part on how I am utilizing leaguedashteamstats? or is this a bug?

Thanks

Code

season_game_stats = LeagueDashTeamStats( measure_type_detailed_defense='Opponent', per_mode_detailed='PerGame', player_position_abbreviation_nullable='C', season='2023-24', last_n_games="2", )

rsforbes commented 7 months ago

PerGame returns an average. Use Totals.

SrijithVenkat commented 7 months ago
Screenshot 2024-02-15 at 11 31 39 AM

Even using "Totals" for last_n_games = 1, results in decimals.

Also, to my understanding the PerGame average of 1 game should be whole numbers anyway no?

rsforbes commented 7 months ago

You'd certainly expect whole numbers on totals or n=1. We don't control the data response as we just expose the endpoint. I'll take a look over the weekend and see what the actual stats pages are showing.

On Thu, Feb 15, 2024, 12:32 PM SrijithV @.***> wrote:

Screenshot.2024-02-15.at.11.31.39.AM.png (view on web) https://github.com/swar/nba_api/assets/95888452/03157df9-0224-4d1c-be2b-1cbe392a5e58 Even using "Totals" for last_n_games = 1, results in decimals.

Also, to my understanding the PerGame average of 1 game should be whole numbers anyway no?

— Reply to this email directly, view it on GitHub https://github.com/swar/nba_api/issues/428#issuecomment-1946699125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGO32SQGQENPPDRMKNQUR3YTZBEXAVCNFSM6AAAAABDJSVRWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBWGY4TSMJSGU . You are receiving this because you commented.Message ID: @.***>

SrijithVenkat commented 7 months ago

I appreciate your help on this! So, I checked it and the only difference between PerGame and Totals returning decimals, and the NBA website is rounding. So, I just added a round to fix the "issue". Thanks once again!