Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to centre and change font colour of pandas dataframe caption?

enter image description hereHow do I centre the caption of my d15N_model dataframe and make the caption font black instead of grey using pandas .style.set_caption() styler function?

d15N_model = d15N_model.style.set_caption("d15N Model Fixed Effect Statistics")

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can create a dictionary of your preferred caption style:

Styles = [dict(selector = "caption", 
               props = [("color", "black"), 
                        ("text-align", "center"])]

Then set these Styles in set_table_styles:

d15N_model = d15N_model.style.set_caption("d15N Model Fixed Effect Statistics").set_table_styles(Styles)

PS you can set other HTML properties such as background-color, font-size, and font-family.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading