i have a special list like this:
[0,0,0,1,0,1,0,1,1,1,0,1]
I want it map to a char list like:
['+','+','+','-','+','-','+','-','-','-','+','-']
here is some code. it multiplies probabilities to calculate joint probabilities:
def solve_all_asigned(self,joint_s):
mult_val=1
for tab in self.tables:
if tab['decision']:
continue
name=tab['name']
nr=name.replace('.',' ')
nr_spd=re.split(' ',nr)
val=''
check_list=[x in joint_s.keys() for x in nr_spd]
if False in check_list:
continue
val=''.join(map(joint_s.get,nr_spd))
mult_val=mult_val*tab[val]
return mult_val
n=22
joint_s2={}
all_combinations=list(itertools.product([0,1],repeat=n))
for binlist in all_combinations:
for i in range(n):
joint_s2[nan_set[i]]='+' if binlist[i]=='0' else '-'
s.append(self.solve_all_asigned(joint_s2))
ss=sum(s)
joint_s:{'AA': 'nan', 'AC': 'nan', 'AB': 'nan', 'AE': 'nan', 'AD': 'nan', 'AF': 'nan', 'A': 'nan', 'C': 'nan', 'B': 'nan', 'E': 'nan', 'D': 'nan', 'G': 'nan', 'F': 'nan', 'I': 'nan', 'H': 'nan', 'K': 'nan', 'J': 'nan', 'M': 'nan', 'L': 'nan', 'O': 'nan', 'N': 'nan', 'Q': 'nan', 'P': '+', 'S': 'nan', 'R': 'nan', 'U': 'nan', 'T': 'nan', 'W': 'nan', 'V': 'nan', 'Y': 'nan', 'X': '+', 'Z': 'nan'}
nan_set:['A', 'C', 'B', 'E', 'D', 'G', 'F', 'I', 'H', 'K', 'J', 'M', 'L', 'O', 'N', 'Q', 'S', 'R', 'U', 'T', 'W', 'V']
tab:{'name': 'A.B', '--': 0.19999999999999996, 'decision': False, '+-': 0.6, '++': 0.4, '-+': 0.8}
how can I do this?