基于numpy
world_alcolhol是numpy的array类型
# Boolean vector corresponding to Canada and 1986. canada_1986 = (world_alcohol[:,2] == "Canada") & (world_alcohol[:,0] == "1986") # We can then use canada_1986 to subset a matrix -- it‘s just a normal boolean vector print(world_alcohol[canada_1986,:])
原文:http://www.cnblogs.com/arsh/p/5118954.html