CommonPlayerInfo
#Description
This endpoint returns information about the players
from nba_api.stats.endpoints import commonplayerinfo
commonplayerinfo.CommonPlayerInfo(`parameter`)
#Query Parameters
API Parameter Name | Python Parameter Variable | Description | Status | Nullable |
---|---|---|---|---|
PlayerID(opens new window) | player_id | Player ID gotten from the static module | Required | No |
LeagueID(opens new window) | league_id_nullable | League ID | Optional | Defaults to NBA. Other options include ABA, G league, WNBA. |
#Arguments Taken
This Endpoint can take a number of arguments to refine the search.
['AvailableSeasons', 'CommonPlayerInfo', 'PlayerHeadlineStats']
#Response
The responses for each of the arguments is provided in the json object below.
{"AvailableSeasons": ["SEASON_ID"], "CommonPlayerInfo": ["PERSON_ID", "FIRST_NAME", "LAST_NAME", "DISPLAY_FIRST_LAST", "DISPLAY_LAST_COMMA_FIRST", "DISPLAY_FI_LAST", "PLAYER_SLUG", "BIRTHDATE", "SCHOOL", "COUNTRY", "LAST_AFFILIATION", "HEIGHT", "WEIGHT", "SEASON_EXP", "JERSEY", "POSITION", "ROSTERSTATUS", "TEAM_ID", "TEAM_NAME", "TEAM_ABBREVIATION", "TEAM_CODE", "TEAM_CITY", "PLAYERCODE", "FROM_YEAR", "TO_YEAR", "DLEAGUE_FLAG", "NBA_FLAG", "GAMES_PLAYED_FLAG", "DRAFT_YEAR", "DRAFT_ROUND", "DRAFT_NUMBER"], "PlayerHeadlineStats": ["PLAYER_ID", "PLAYER_NAME", "TimeFrame", "PTS", "AST", "REB", "PIE"]}
#Example
Getting the stats of LeBron James
from nba_api.stats.endpoints import commonplayerinfo
lebron_data = commonplayerinfo.CommonPlayerInfo(2544)
lebron_data.json()
Results:
'{"resource": "commonplayerinfo", "parameters": [{"PlayerID": 2544}, {"LeagueID": null}], "resultSets": [{"name": "CommonPlayerInfo", "headers": ["PERSON_ID", "FIRST_NAME", "LAST_NAME", "DISPLAY_FIRST_LAST", "DISPLAY_LAST_COMMA_FIRST", "DISPLAY_FI_LAST", "PLAYER_SLUG", "BIRTHDATE", "SCHOOL", "COUNTRY", "LAST_AFFILIATION", "HEIGHT", "WEIGHT", "SEASON_EXP", "JERSEY", "POSITION", "ROSTERSTATUS", "GAMES_PLAYED_CURRENT_SEASON_FLAG", "TEAM_ID", "TEAM_NAME", "TEAM_ABBREVIATION", "TEAM_CODE", "TEAM_CITY", "PLAYERCODE", "FROM_YEAR", "TO_YEAR", "DLEAGUE_FLAG", "NBA_FLAG", "GAMES_PLAYED_FLAG", "DRAFT_YEAR", "DRAFT_ROUND", "DRAFT_NUMBER", "GREATEST_75_FLAG"], "rowSet": [[2544, "LeBron", "James", "LeBron James", "James, LeBron", "L. James", "lebron-james", "1984-12-30T00:00:00", "St. Vincent-St. Mary HS (OH)", "USA", "St. Vincent-St. Mary HS (OH)/USA", "6-9", "250", 19, "6", "Forward", "Active", "N", 1610612747, "Lakers", "LAL", "lakers", "Los Angeles", "lebron_james", 2003, 2022, "N", "Y", "Y", "2003", "1", "1", "Y"]]}, {"name": "PlayerHeadlineStats", "headers": ["PLAYER_ID", "PLAYER_NAME", "TimeFrame", "PTS", "AST", "REB", "PIE"], "rowSet": [[2544, "LeBron James", "2021-22", 30.3, 6.2, 8.2, 0.18]]}, {"name": "AvailableSeasons", "headers": ["SEASON_ID"], "rowSet": [["12003"], ["22003"], ["12004"], ["22004"], ["32004"], ["12005"], ["22005"], ["32005"], ["42005"], ["12006"], ["22006"], ["32006"], ["42006"], ["12007"], ["22007"], ["32007"], ["42007"], ["12008"], ["22008"], ["32008"], ["42008"], ["12009"], ["22009"], ["32009"], ["42009"], ["12010"], ["22010"], ["32010"], ["42010"], ["12011"], ["22011"], ["32011"], ["42011"], ["12012"], ["22012"], ["32012"], ["42012"], ["12013"], ["22013"], ["32013"], ["42013"], ["12014"], ["22014"], ["32014"], ["42014"], ["12015"], ["22015"], ["32015"], ["42015"], ["12016"], ["22016"], ["32016"], ["42016"], ["12017"], ["22017"], ["32017"], ["42017"], ["12018"], ["22018"], ["32018"], ["12019"], ["22019"], ["32019"], ["42019"], ["12020"], ["22020"], ["32020"], ["42020"], ["52020"], ["12021"], ["22021"], ["32021"]]}]}'