Why do I get an AttributeError when using .count() in python
Question: `array1=[ 0 5 6 6 6 0 6 0 6 8 0 19 24 7 0 4 9 14 12 0 22 17 1 0 19 6 17 4 7 0
17 24 0 6 9 22]`

    
    
    i=0
    while i<23
          m= array1.count(i)
          i=i+1
    

`AttributeError: 'numpy.ndarray' object has no attribute 'count'`

Why does attribute error appear when i use .count()? do I need to import
something?


Answer: Well, according to the
[documentation](http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html),
`ndarray` simply has no `count` method.

The code you have posted contradicts the error-message you give us. In your
code you create a simple Python list, but your error message indicates that
you are actually using a numpy `ndarray`.

