Hello, @Cyrille!
Am I correct to assume you want this in SageCell output? If that is the case, you can obtain bold fonts specifying manually that option: instead of 'a'
in header_column
, you can write r'<b>aa</b>'
. The "r" just before the first simple quote sign indicates that this is a "raw string", so it must be used AS IS written by you; in this case, we are using a little bit of HTML, using the <b>
and </b>
to indicate bold font. So, you have to do:
rows = [[100,2,3], [4,5,60]]
t = table(rows, header_row=['a', 'b','c'], header_column=['',r'<b>aa</b>', r'<b>bb</b>'])
show(t)
Now, I don't think this is exactly what you want. First of all, the aa
and bb
will appear to be blue. You can change that by using a little bit more of HTML:
rows = [[100,2,3], [4,5,60]]
t = table(rows, header_row=['a', 'b','c'], header_column=['',r'<b style="color:black">aa</b>', r'<b style="color:black">bb</b>'])
show(t)
Finally, I understand that you want a frame for your table. You have to use the frame=True
option:
rows = [[100,2,3], [4,5,60]]
t = table(rows, header_row=['a', 'b','c'], header_column=['',r'<b style="color:black">aa</b>', r'<b style="color:black">bb</b>'], frame=True)
show(t)
Of course, you can adapt this technique to other forms of output. For example, if you were working on Sage through LaTeX (by means of SageTeX, for example), you could do the following, which is equivalent to what we just did:
rows = [[100,2,3], [4,5,60]]
t = table(rows, header_row=[r'\textbf{a}','\textbf{b}','\textbf{c}'], header_column=['',r'\textbf{aa}', r'\textbf{bb}'], frame=True)
show(t)
However, do be careful, since the frame=True
option already highlights the headers for the rows and columns by placing a double line separation, so perhaps using bold font is too much.
One more thing: If you don't like the alignment of the columns, remember you can always use the align='center'
option.