title: Finding the index of the minimum and maximum values in a NumPy array
body: <p>I'm working on a small data analysis assignment with a dataset of NBA players and several attributes, such as height, weight, etc. Here is a small sample of the dataset:</p>
  
  <pre><code>players = ['Aaron Gordon', 'Aaron Holiday', 'Abdel Nader', 'Al Horford', 'Al-Farouq Aminu']
  years_old = [23, 22, 25, 32, 28]
  height_inches = [81, 73, 78, 82, 81]
  weight_pounds = [220, 185, 225, 245, 220]
  </code></pre>
  
  <p>I'm trying to create a program that finds the indexes of the shortest and tallest players in this dataset. I've converted these lists into NumPy arrays, and I'm able to successfully find the smallest and tallest players, but I'm not sure how to get the index of those particular players.</p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>np_players = np.array(players)
  np_years_old = np.array(years_old)
  np_height_inches = np.array(height_inches)
  np_weight_pounds = np.array(weight_pounds)
  
  def shortest_player(np_h):
    mask = np.argmin(np_h)
    idx = np.where(mask)
    return idx
  
  def tallest_player(np_h):
    mask = np.argmax(np_h)
    idx = np.where(mask)
    return idx
  </code></pre>
  
  <p>This is the error I receive when I try to test these functions while running the following line <code>print(players[ shortest_player(np_height_meters) ] )</code>: </p>
  
  <blockquote>
    <p>TypeError Traceback (most recent call last)
     in () 9 return idx 10 ---> 11
    print(players[tallest_player(np_height_meters)]) TypeError: list
    indices must be integers or slices, not tuple</p>
  </blockquote>
  
  <p>As an example, in the sample dataset provided, the functions would ideally return 1 for the shortest player and 3 for the tallest player.</p>
  
  <p>Any insight or advice? </p>