How to get nba shot chart data correctly?

  nba-api, python

I want to get data from nba site to create shot chart. I get it from this site https://datavizardry.com/2020/01/28/nba-shot-charts-part-1/?fbclid=IwAR3BheHQkSAmCJRr_z7ux1ygbspLjLdrvTRjWAVHOrr2BPvVh7jsIos_e9w and my code looks like this:

from nba_api.stats.endpoints import shotchartdetail
import json
import pandas as pd

response = shotchartdetail.ShotChartDetail(
    team_id=0,
    player_id=0,
    season_nullable='2001-02',
    season_type_all_star='Regular Season'
)

content = json.loads(response.get_json())

results = content['resultSets'][0]
headers = results['headers']
rows = results['rowSet']
df = pd.DataFrame(rows)
df.columns = headers

# write to csv file
df.to_csv(r'C:UsersCompDesktopnba_2001-02.csv', index=False)

It is working but in this articule when I download example data from the beginning, the Author in data gets info about missed shots too, when I run my code I get only data about shots made. Is it possible to get info about missed shots too or nba not shares this data anymore?

Source: Python Questions

LEAVE A COMMENT