Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Table not constructed becaus list is not iterable

Sorry but one more time I encounter a surprising problem

ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
cond1 = ['\tiny${}{}{}{}$'.format(*w) for w in Ap]

are two lists (I have verifies by type(). But when I type

table(ne1, header_column=cond1)

the return is an error 'sage.rings.integer.Integer' object is not iterable. There is something I miss.

Table not constructed becaus list is not iterable

Sorry but one more time I encounter a surprising problem

ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
cond1 = ['\tiny${}{}{}{}$'.format(*w) for w in Ap]

are two lists (I have verifies by type(). But when I type

table(ne1, table([ne1], header_column=cond1)

\tiny doesn't work and the return is an error 'sage.rings.integer.Integer' object is cells are not iterable. There is something I miss.centered. Is it possible ?

Table not constructed becaus list is not iterable

Sorry but one more time I encounter a surprising problem

ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
cond1 = ['\tiny${}{}{}{}$'.format(*w) for w in Ap]

are two lists (I have verifies by type(). But when I type

table([ne1], header_column=cond1)

\tiny doesn't work and the cells are not centered. Is it possible ?

Table not constructed becaus list is not iterableCentering the cells of a table and the use of tiny size

Sorry but one more time I encounter a surprising problemchange my question to be clearer. In the following code (I have integrated the solution for \tiny :

ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
cond1 = ['\tiny${}{}{}{}$'.format(*w) ne=ne1
Ap=All_pref(cand,2) 
cond1=['$\\tiny${}{}{}{}$'.format(*w) for w in Ap]
cond2 =[""]+ [r'${}$'.format(*w) for w in cand]
cond3 =[r'${}$'.format(*w) for w in cand]
t1=table([ne],header_row=cond1)
rank=[[x.find(l) for x in Ap] for l in cand] 
score_de_Borda=[[abs(x.find(l)-len(cand)) for x in Ap] for l in cand]
t2=table(rank,header_row=cond1,header_column=cond2)
total_score_de_Borda=[add([score_de_Borda[j][i]*ne[i] for i in range(24)]) for j in range(len(cand))]
#t3=table(total_score_de_Borda,header_column=cond3)
show(cond3,total_score_de_Borda)

are two lists (I have verifies by all works fine les the type(). But when I type

table([ne1], header_column=cond1)

\tiny,header_column=cond3 doesn't work (without it I have no problem) and as show(cond3,total_score_de_Borda) shows the cells are not centered. Is it possible ?two elements have the same length.

Centering the cells of a table and the use of tiny size

I change my question to be clearer. In the following code (I have integrated the solution for \tiny :

cand=["A","B","C","D"]
ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
    ne=ne1
 Ap=All_pref(cand,2) 
 cond1=['$\\tiny${}{}{}{}$'.format(*w) for w in Ap]
 cond2 =[""]+ [r'${}$'.format(*w) for w in cand]
 cond3 =[r'${}$'.format(*w) for w in cand]
 t1=table([ne],header_row=cond1)
 rank=[[x.find(l) for x in Ap] for l in cand] 
 score_de_Borda=[[abs(x.find(l)-len(cand)) for x in Ap] for l in cand]
 t2=table(rank,header_row=cond1,header_column=cond2)
 total_score_de_Borda=[add([score_de_Borda[j][i]*ne[i] for i in range(24)]) for j in range(len(cand))]
 #t3=table(total_score_de_Borda,header_column=cond3)
 show(cond3,total_score_de_Borda)

all works fine les the ,header_column=cond3 (without it I have no problem) and as show(cond3,total_score_de_Borda) shows the two elements have the same length.

Centering the cells of a table and the use of tiny size

I change my question to be clearer. In the following code (I have integrated the solution for \tiny :

def All_pref(cand=["A","B","C","D"],code=1) : ncand=len(cand) Scand=sorted(Set(cand)) all_pref=Arrangements(Scand,ncand).list() all_pref1=[str(Word(x)) for x in all_pref] if code==1 : return ncand if code==2 : return all_pref1

cand=["A","B","C","D"]
ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
    ne=ne1
    Ap=All_pref(cand,2) 
    cond1=['$\\tiny${}{}{}{}$'.format(*w) for w in Ap]
    cond2 =[""]+ [r'${}$'.format(*w) for w in cand]
    cond3 =[r'${}$'.format(*w) for w in cand]
    t1=table([ne],header_row=cond1)
    rank=[[x.find(l) for x in Ap] for l in cand] 
    score_de_Borda=[[abs(x.find(l)-len(cand)) for x in Ap] for l in cand]
    t2=table(rank,header_row=cond1,header_column=cond2)
    total_score_de_Borda=[add([score_de_Borda[j][i]*ne[i] for i in range(24)]) for j in range(len(cand))]
    #t3=table(total_score_de_Borda,header_column=cond3)
    show(cond3,total_score_de_Borda)

all works fine les the ,header_column=cond3 (without it I have no problem) and as show(cond3,total_score_de_Borda) shows the two elements have the same length.

Centering the cells of a table and the use of tiny size

I change my question to be clearer. clarify. In the following code (I have integrated the solution for \tiny :

):

First define a function:

def All_pref(cand=["A","B","C","D"],code=1) All_pref(cand=["A", "B", "C", "D"], code=1) :
    ncand=len(cand)
    Scand=sorted(Set(cand))
    all_pref=Arrangements(Scand,ncand).list()
    all_pref1=[str(Word(x)) ncand = len(cand)
    Scand = sorted(Set(cand))
    all_pref = Arrangements(Scand, ncand).list()
    all_pref1 = [str(Word(x)) for x in all_pref]
    if code==1 :
code == 1:
        return ncand
    if code==2 :
code == 2:
        return all_pref1all_pref1

Then use it:

cand=["A","B","C","D"]
ne1=[18,16,14,12,11,20,19,14,16,12,2,1,0,0,20,16,13,15,11,10,9,8,7,5]
    ne=ne1
    Ap=All_pref(cand,2) 
    cond1=['$\\tiny${}{}{}{}$'.format(*w) cand = ["A", "B", "C", "D"]
ne1 = [18, 16, 14, 12, 11, 20, 19, 14, 16, 12, 2, 1, 0, 0, 20, 16, 13, 15, 11, 10, 9, 8, 7, 5]
ne = ne1
Ap = All_pref(cand,2) 
cond1 = ['$\\tiny${}{}{}{}$'.format(*w) for w in Ap]
 cond2 =[""]+ = [""] + [r'${}$'.format(*w) for w in cand]
 cond3 =[r'${}$'.format(*w) = [r'${}$'.format(*w) for w in cand]
    t1=table([ne],header_row=cond1)
    rank=[[x.find(l) t1 = table([ne], header_row=cond1)
rank = [[x.find(l) for x in Ap] for l in cand] 
    score_de_Borda=[[abs(x.find(l)-len(cand)) score_de_Borda = [[abs(x.find(l) - len(cand)) for x in Ap] for l in cand]
    t2=table(rank,header_row=cond1,header_column=cond2)
    total_score_de_Borda=[add([score_de_Borda[j][i]*ne[i] t2 = table(rank,header_row=cond1,header_column=cond2)
total_score_de_Borda = [add([score_de_Borda[j][i]*ne[i] for i in range(24)]) for j in range(len(cand))]
    #t3=table(total_score_de_Borda,header_column=cond3)
    # t3 = table(total_score_de_Borda,header_column=cond3)
show(cond3,total_score_de_Borda)

all everything works fine les apart from the ,header_column=cond3 (without it I have no problem) and as show(cond3,total_score_de_Borda) shows show(cond3, total_score_de_Borda) shows, the two elements have the same length.

Centering the cells of a table and the use of tiny size

I change my question to clarify. In the following code (I have integrated the solution for \tiny):

First define a function:

def All_pref(cand=["A", "B", "C", "D"], code=1) :
    ncand = len(cand)
    Scand = sorted(Set(cand))
    all_pref = Arrangements(Scand, ncand).list()
    all_pref1 = [str(Word(x)) for x in all_pref]
    if code == 1:
        return ncand
    if code == 2:
        return all_pref1

Then use it:

cand = ["A", "B", "C", "D"]
ne1 = [18, 16, 14, 12, 11, 20, 19, 14, 16, 12, 2, 1, 0, 0, 20, 16, 13, 15, 11, 10, 9, 8, 7, 5]
ne = ne1
Ap = All_pref(cand,2) All_pref(cand, 2) 
cond1 = ['$\\tiny${}{}{}{}$'.format(*w) for w in Ap]
cond2 = [""] + [r'${}$'.format(*w) for w in cand]
cond3 = [r'${}$'.format(*w) for w in cand]
t1 = table([ne], header_row=cond1)
rank = [[x.find(l) for x in Ap] for l in cand] 
score_de_Borda = [[abs(x.find(l) - len(cand)) for x in Ap] for l in cand]
t2 = table(rank,header_row=cond1,header_column=cond2)
table(rank, header_row=cond1, header_column=cond2)
total_score_de_Borda = [add([score_de_Borda[j][i]*ne[i] for i in range(24)]) for j in range(len(cand))]
# t3 = table(total_score_de_Borda,header_column=cond3)
table(total_score_de_Borda, header_column=cond3)
show(cond3,total_score_de_Borda)

everything works fine apart from the ,header_column=cond3header_column=cond3 (without it I have no problem) and as show(cond3, total_score_de_Borda) shows, the two elements have the same length.