swar / nba_api

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

get_data_frames() not working on leaguedashteamshotlocations #98

Open JonStep123 opened 4 years ago

JonStep123 commented 4 years ago

Hey @swar,

This API has been very useful for gathering data easily, however, I ran into an error when trying to pull using leaguedashteamlocations. the only parameter im passing is team_id_nullable and it works fine with get_dict(). I'm sure I'm just doing something wrong but any assistance would be appreciated!

image

swar commented 4 years ago

Can you post the exact code you were using and I can investigate?

JonStep123 commented 4 years ago

image

swar commented 4 years ago

What version of nba_api are you using?

raw_data = leaguedashteamstats.LeagueDashTeamStats(team_id_nullable=1610612737)
print(raw_data.get_response())
print(raw_data.get_data_frames()[0])

This just worked for me.

JonStep123 commented 4 years ago

most of the functions work, for example, the one you just said, however getting the shot locations has not worked for me. I am using the most current version.

swar commented 4 years ago

Can you post an example of how you're using it? I'll need to do some research on this one because they change the usage of that endpoint frequently.

JonStep123 commented 4 years ago

I did so in the previous comment but I will post it again. This is exactly how I am calling it. In your response to that comment, you posted that LeagueDashTeamStats was working for you, which is working for me as well, however, LeagueDashTeamShotLocations is what isn't working for me. image

swar commented 4 years ago

Oh wow, I totally tested the wrong endpoint originally. Sorry about that. I'll look into this later today.

swar commented 4 years ago

@JonStep123 I am so sorry. I started looking into this and never posted it and then I got busy with work and the holidays.

Is this issue still persisting for you? This happens to be working for me.

from nba_api.stats.endpoints import *

raw_data = leaguedashteamshotlocations.LeagueDashTeamShotLocations(team_id_nullable=1610612737)
print(raw_data.get_response())
print(raw_data.get_json())
swar commented 4 years ago

Feel free to reopen or create a new ticket if you still have questions.

SpecCRA commented 4 years ago

@swar It seems the issue is not in the other endpoint returns but only the get_dataframe() one. I can get a response grabbing json or dict, but they return a huge string that I would then need to parse myself. This is persistent for LeagueDashTeamShotLocations and LeagueDashPlayerShotLocations.

swar commented 4 years ago

@SpecCRA I see what you mean. This one looks like it might need special handling for it to become a dataframe. I for some reason was misinterpreting the original message.

I will open this back up and mark it as a bug.