6

How can I generate appropriate HTML to hand to an ipywidgets.HTML object to properly display a Pandas DataFrame?

enter image description here

Thomas K
  • 39,200
  • 7
  • 84
  • 86
MRocklin
  • 55,641
  • 23
  • 163
  • 235

1 Answers1

9

This can be achieved with the lovely new DataFrame.style class.

For example

enter image description here

This example depends on bootstrap's CSS being loaded on the page. It's included in the notebook when you're running the notebook interactively.

More generally a mixture of set_table_attributes to give it a class, and set_table_styles for more specific items should give pretty fine-grained controls.

TomAugspurger
  • 28,234
  • 8
  • 86
  • 69