title: Using numpy shape output in logic
body: <p>I am using Python 2.7.5 on Windows 7. For some reason python doesn't like it when I use one of the dimensions of my numpy array to with a comparator in an if statement:</p>
  
  <pre><code>a = np.array([1,2,3,4])
  # reshapes so that array has two dimensions
  if len(np.shape(a)) == 1:
      a = np.reshape(a, (1, np.shape(a)))
  
  b = np.shape(a)[0]
  
  if b &lt;= 3:
      print 'ok'
  </code></pre>
  
  <p>I create a 1D numpy array (in actuality 'a' is an input that may be 1D or 2D). Then I reshape this to form a 2D numpy array. I try to use the size of the newly created dimension as a comparator and I get an error: "TypeError: an integer is required"</p>
  
  <p>I also tried "int(b)" to convert the long integer to a plain integer in the if statement and it gives the same error. If I do "type(b)" it gives me "type 'long'". I feel as though I've done this before without any problems, but I can't find any examples. Is it something with how I change the 1D array to a 2D array? Any help is appreciated.</p>