-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with attributes for outputting data and required parameters for endpoints #31
Comments
I tried to explain here (Endpoint Analysis Format.md) that required parameters are parameters that are required to be passed, but can also be nullable. Meaning you must pass them in as parameters, but they don't need any values. Let's take the (CommonPlayoffSeries Endpoint](https://github.com/swar/nba_api/blob/master/docs/nba_api/stats/endpoints/commonplayoffseries.md) as an example. Here is the Parameters chart:
Here is a valid URL to visit the Endpoint: https://stats.nba.com/stats/commonplayoffseries?LeagueID=&Season=2017-18&SeriesID= Both Since Hopefully that clears up any confusion you might have on that. What you have made me realize is that I do not list the default values passed to parameters in the endpoint documentation. In order to see the default values, you need to manually click on each API Parameter name to see the assigned default. These would be the values required for you to input to get the Python API call to work. A temporary solution is to look at the Python file (linked at the top of each documentation page) to see the values passed into the endpoints. To answer your last paragraph, sometimes Endpoints return many different sets of data which is what I defined as a data set in the package. Here are the available data sets for ShotChartDetail Feel free to re-ask a question if I missed it. |
I was looking for this page and just hadn't stumbled across it yet. Thank you for taking the time to answer my question in such detail! I think I was most confused about which values have a default value and how it affected the output after getting several errors about what's required and what wasn't. |
Hi! iI wanted to say thank you for making this API first of all. I've seen and gotten some great data from it so far.
I have a few issues with everything, and I don't know if I'm just missing bits in the documentation.
For example, here's one snippet of code I have for ShotChartDetail:
initial_data = ShotChartDetail(player_id = ghay_id, # id of player season_nullable = current_year, # which year team_id=0, # team id used if multiple players found context_measure_simple='FGA')
Now I know I completed the required parameters, but it looks inconsistent with what's written in the documentation for that endpoint.
In the documentation, the required parameters are then listed as such:
"required_parameters": [ "ContextMeasure", "DateFrom", "DateTo", "GameID", "GameSegment", "LastNGames", "Location", "Month", "OpponentTeamID", "Outcome", "Period", "PlayerID", "PlayerPosition", "RookieYear", "SeasonSegment", "SeasonType", "TeamID", "VsConference", "VsDivision" ],
So is there a more complete way for me to see what parameters are required for each endpoint?
Furthermore, I see people using the
get_data_frames()
attribute on the objects afterwards to extract the data into a pandas dataframe which is great. I noticed there are plenty of other attributes when using PyCharm. For ShotChartDetails, it outputs two dataframes, so I am confused as to what each endpoint does output and what attributes are available for use.Is there documentation or another guide to show the available attributes and its associated outputs?
Thanks!
Ben
The text was updated successfully, but these errors were encountered: