Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
With all the clarifications, the most concise that I could come up with:
import numpy as np
import itertools
ind=np.array([, ])
M=4
lt=np.zeros((len(ind),1,M+1),dtype=int)
for a in range(len(ind)):
lt[a,0,list(itertools.chain(*ind[a]))]+=1
print(lt)
[
]
ind.shape
Out[15]: (2, 1, 3)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question