I have a case where I need 2 for loops (i and k) as shown below. And I want to continue with the inner loop after I left it.
import numpy as np
X = [[12, 11, 1], [1,2,3]]
mu = [1, 2, 3]
sublist = []
for i in range(0, 4):
for k in range(0, 3):
subtr = X[i] - mu[k]
sublist.append(subtr)
# leaving the loop k to calc argmin
agmin = np.argmin(sublist)
C.append(agmin)
# Now I want to get back to the inner loop (k) to continue #further calculation, but obviously will result an error.
np.dot((C[i] == k),X[i])
What is the best way to deal with such cases?
.dotoperation inside the loop? Or even yet, start the inner loop over again!