title: Iterating through a two dimensional array in Python?
body: <p>I'm trying to iterate through a two dimensional array in Python and compare items in the array to ints, however I am faced with a ton of various errors whenever I attempt to do such. I'm using numpy and pandas.</p>
  
  <p>My dataset is created as follows:</p>
  
  <pre><code>filename = "C:/Users/User/My Documents/JoeTest.csv"
  datas = pandas.read_csv(filename)
  dataset = datas.values
  </code></pre>
  
  <p>Then, I attempt to go through the data, grabbing certain elements of it.</p>
  
  <pre><code>def model_building(data):
  global blackKings
  flag = 0;
  blackKings.append(data[0][1])
  for i in data:
      if data[i][39] == 1:
          if data[i][40] == 1:
              values.append(1)
          else:
              values.append(-1)
      else:
          if data[i][40] == 1:
              values.append(-1)
          else:
              values.append(1)
      for j in blackKings:
          if blackKings[j] != data[i][1]:
              flag = 1
      if flag == 1:
          blackKings.append(data[i][1])
          flag = 0;
  </code></pre>
  
  <p>However, doing so leaves me with a ValueError: The Truth value of an array with more than one element is ambiguous. Use a.any() or a.all(). I don't want to use either of these, as I'm looking to compare the actual value of that one specific instance. Is there another way around this problem?</p>