3

Pandas style options let me format the data but i want to add border to the column headers, that is row 0.

htmlFooterOutdatedList = dfServerOutdated[['System Name','IP Address','Last Communication','DAT (VSE)','OS Type','Status']].style.hide_index().set_properties(**{'font-size': '10pt','background-color': '#edeeef','border-color': 'black','border-style' :'solid' ,'border-width': '1px','border-collapse':'collapse', 'padding': '5px'}).applymap(datversion,subset = 'DAT (VSE)').applymap(LTSCDate,subset = 'Last Communication').background_gradient(cmap='PuBu', low=0, high=0, axis=0, subset='DAT (VSE)', text_color_threshold=0.458).set_table_styles([{'selector': 'th', 'props': [('font-size', '12pt')]}]).set_properties(subset=['Last Communication'], **{'width': '180px'}).set_properties(subset=['System Name'], **{'width': '30px'}).set_properties(subset=['Status'], **{'width': '90px'}).render()

Whi the rows are formatted, the column header border is missing which I want to add.

Can I add borders to column headers ?

1 Answer 1

10

Inside your (admittedly very long) line of code, you already have:

.set_table_styles([{'selector': 'th', 'props': [('font-size', '12pt')]}])

which you can expand by common CSS attributes, e.g.:

.set_table_styles([{'selector': 'th', 'props': [('font-size', '12pt'),('border-style','solid'),('border-width','1px')]}])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.