title: comparing row in numpy array
body: <p>I have a 2d numpy array of bools, and I'd like to know how many unique rows my data set contains and the frequency of each row. The only way I could solve this problem is by converting my whole data set into a string and then do the comparison, but surely there must be a better way to do this. Any help is appreciated.</p>
  
  <pre><code>def getUniqueHaplotypes(self,data):
  nHap=data.shape[0]
  unique=dict() 
  for i in range(nHap):
      s = "".join([str(j) for j in data[i]])
      if unique.has_key(s):
          unique[s]+=1
      else:
          unique[s] = 1
  
  return unique
  </code></pre>