code: def _api_scrape(json_inp, ndx):
      
  
      try:
          headers = json_inp['resultSets'][ndx]['headers']
          values = json_inp['resultSets'][ndx]['rowSet']
      except KeyError:
          # This is so ugly but this is what you get when your data comes out
          # in not a standard format
          try:
              headers = json_inp['resultSet'][ndx]['headers']
              values = json_inp['resultSet'][ndx]['rowSet']
          except KeyError:
              # Added for results that only include one set (ex. LeagueLeaders)
              headers = json_inp['resultSet']['headers']
              values = json_inp['resultSet']['rowSet']
      if HAS_PANDAS:
          return DataFrame(values, columns=headers)
      else:
          # Taken from www.github.com/bradleyfay/py-goldsberry
          return [dict(zip(headers, value)) for value in values]
docs: Internal method to streamline the getting of data from the json
  
      Args:
          json_inp (json): json input from our caller
          ndx (int): index where the data is located in the api
  
      Returns:
          If pandas is present:
              DataFrame (pandas.DataFrame): data set from ndx within the
              API's json
          else:
              A dictionary of both headers and values from the page