title: counting numpy array values and comparing against a list
body: <p>I have a numpy array and a list that I want to relate to each other in order to produce a second list.</p>
  <p>List 1: 399 values. Many object names repeat multiple times, e.g.: aaabbbbccdddddddde, etc.
  Array 1: 38 values, all of which appear in List 1 exactly once. e.g.: abcde,etc. I extracted them from list 1 using numpy unique
  List 2: Here I want to count how many times each unique value in List 2 appears in List 1. e.g.: 3,4,2,8,1</p>
  <p>The second and third lists will be put in a pandas data frame, something like this</p>
  <pre><code>Array 2     List 2  
    a          3
    b          4
    c          2
    d          8
    e          1
  </code></pre>
  <p>This code . . .</p>
  <pre><code>array1 = np.array(array1.tolist())
  
  listCount = 0
  
  print(sessions.count())
  
  while listCount &lt;= len(list1):
          list2 = (array1.count(list1[listCount]))
          listCount = listCount + 1
  
  . . . gets me this error:
  </code></pre>
  <p>&quot;AttributeError: 'numpy.ndarray' object has no attribute 'count'&quot;</p>
  <p>I'm really confused, especially since I thought I converted the array to a list.</p>