[Tutor] question on array Operation
jarod_v6 at libero.it
jarod_v6 at libero.it
Wed Oct 29 17:08:28 CET 2014
Dear All,
I have a long matrix where I have the samples (1to n) and then I have (1to j )elements.
I would like to count how many times each j element are present on each samples.
So the question is which is the best algoritm for obtain the results. The result I want is a table like that.
A,B,D,E,F
AA,1,0,1,0
BB1,1,1,1
CC0,0,1,0
DD01,0,1,0
Do you have any suggestion on how to do this? only using a loop like:
A is a list with some names A=[AA,BB,ZZ,TT,NN]
if AA in A:
print 1
else :
print 0
thanks in advance for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20141029/ca8bdc9c/attachment.html>
More information about the Tutor
mailing list