Question: I have a following format of data

```
 ....
 16      4      2      5     23      0      0      0      0
 17      3      2    270      6      0      0      0      0
 18      3      2     52    332      0      0      0      0
 19      3      2    125    159      0      0      0      0
 20      3      2    156     56      0      0      0      0
 ....

```

From here, I accessed to each columns using for-loop-indexing, for example like

```
>>> print B[i] 
...
4
3
3
3
3
...

```

Here, I hope to count how many times number "7" appears from this column, so, I tried 

```
num_7 = [B[i]].count(7) 

```

But this print out 

```
...
0
0
0
0
0
... 

```

Instead of number of occurrence of 7 from this column (which is 168 in my data). I think this is because the [B[i]] was recognized as a multiple lists of single element, instead of single list or array of multiple elements. When I print [B[i]], it looks 

```
... 
[4]
[3]
[3]
[3]
[3]
...

```

Should I need to transpose to use ~~.count(n) command? How can I get the occurrence number of specific element from the column like this? 

The real question in here should be, how can I convert the data column

```
...
4
3
3
3
3
...

```

to the list 

```
[..., 4, 3, 3, 3, 3, ...] 

```

So that I could use the count(n) command. 

Thanks

Answer: 
`count` is a method for an iterable. I suspect you want:

```
In [46]: B = [1,2,3,4,5]

In [47]: B.count(2)
Out[47]: 1

```

This is assuming that `B` is the column you are looking for. If you have something like this: 

```
In [48]: B = [[1,2,3,4], [4,3,2,1], [7,8,9,10]]

```

Then, indexing that will give you a row not a column: 

```
In [51]: B[1]
Out[51]: [4, 3, 2, 1]

```

You need to reanspose this to get a column. A common way of doing that is the following:

```
In [54]: zip(*B)
Out[54]: [(1, 4, 7), (2, 3, 8), (3, 2, 9), (4, 1, 10)]

```

Then, you can select your columns and count them: 

```
In [56]: zip(*B)[2].count(3)
Out[56]: 1

```
So apparently B is a list of numbers. So you don't want to loop at all. Just do:

```
B.count(7)

```