I would like to replace elements at specific positions in an array baes on the index. Is there a more efficient way than using for loops, e.g. list comprehension? Here is some exemplary code:
n=10
te=15
SampleData=np.random.rand(te,n)
percentiles = np.linspace(0,100,n)
SDist=np.zeros((te,n))
# the fllowing is what I would like to change:
for i in range(n):
for t in range(te):
SDist[t,i]=np.percentile(SampleData[t,:],percentiles[i])
Thanks in advance!