I have a list of n ndarrays and I want to loop through the list to split them into 2 variables such that the ith array is assigned to "a" and rest of them to "b" such that b doesnt contains i. (Say when i=0, it goes to a and rest go to be, now i=1, it goes to a but rest including i=0 and excluding i=1 go to b)
#n=3
lis=[x,y,z] #where x,y,z are ndarrays
for i in lis:
a=i
b=lis.remove(i)
which gives me a value error:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
So I tried the below:
b=[ j for j in lis if not (j==i).all()]
But this returns an empty list.
I used the itertools.permutations but it gave an output of 4 arrays instead of all the permutations.
At this point, I am out of ideas. I am asking for a direction so that I can get this to work. Any help would be appreciated.