How can I generate appropriate HTML to hand to an ipywidgets.HTML
object to properly display a Pandas DataFrame?
Asked
Active
Viewed 2,300 times
6
-
From where do you import VBox? – Alexander Mar 03 '16 at 18:54
-
`from ipywidgets import VBox`. It looks like they export all their widgets there, since they use `from ipywidgets import *` in the docs. – TomAugspurger Mar 03 '16 at 18:58
1 Answers
9
This can be achieved with the lovely new DataFrame.style
class.
For example
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
-
Oh, and it looks like `x` was cast to a float (it wasn't really). This has been fixed in master. – TomAugspurger Mar 03 '16 at 18:49