Makes images of stylized dataframes so that when Jupyter notebooks are reopened, the stylized view is represented. Importantly, it includes tips that also enable it to be done without generating giant file sizes as well.
Click on a launch binder
badge on this page to launch a session where everything needed for this process is set up and the steps in the process are demonstrated.
Pandas dataframe styling is a great feature for visualizing tabular data right in a notebook; however, it is annoying that it gets removed from rendering when you reopen the notebook. (At least every place I have seen so far for apllied cell and text coloring while style.format
settings such as style.format("{:.2%}"
to show floats as percents with two-decimals, seem to survive. Always to be the case for cell and text coloring?) I wanted a way to have at least the information visible when I reload. So an image would at least be viewable, albeit not as interactive.
STEPS:
Pandas dataframe --> Pandas dataframe with conditional stylized cells ---> Pandas dataframe converted to HTML --> image file --> image viewable when notebook reopened.
This builds on the approach from Shovalt here, with some advanced styling following Andy Lane's post.
Addressing the default image size and quality of output was worked out with advice found here (thanks especially to landonwilkins) and here (thanks especially to jarrekk).
Click on a launch binder
badge on this page to launch a session where everything needed for this process is set up and the steps are demonstrated.