[Tutor] question on array Operation

Peter Otten __peter__ at web.de
Wed Oct 29 17:49:06 CET 2014


jarod_v6 at libero.it wrote:

> 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

I'm sorry I have no idea what you are trying to do.

I can't believe that this is your "best effort" to explain the problem, so I 
won't bother to guess.



More information about the Tutor mailing list