For efficieny and extended slices, you can use numpy
- which given your example seems like a good idea:
import numpy as np
yourlist = [
[0, 0, 0],
[0, 1, 1],
[1, 0, 2]
]
a = np.array(yourlist)
print a[:,0]
# [0 0 1]
bc = np.bincount(a[:,0])
# array([2, 1])
count = bc[bc==1].size
# 1
# or... (I think it's probably better...)
count = np.count_nonzero(bc == 1)