Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you change the caption font size using Pandas styling?

Tags:

pandas

I am trying to change the font size of a caption using the pandas styling API. Is this possible?

Here is what I have so far:

import pandas as pd

data = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=data)

df.style.set_caption("Some Caption")

Appreciate any input.

like image 364
J Rock Avatar asked Mar 03 '23 00:03

J Rock


1 Answers

Try this:

df.style.set_caption("Some Caption").set_table_styles([{
    'selector': 'caption',
    'props': [
        ('color', 'red'),
        ('font-size', '16px')
    ]
}])
like image 101
Code Different Avatar answered Mar 05 '23 17:03

Code Different