A python equivalent for R markdown

submited by
Style Pass
2021-06-07 07:00:06

R markdown is a powerful tool for sharing insights with stakeholders. You can write snippets of R code that generate plots. This can then be compiled to a HTML or pdf file that you can share with non-technical stakeholders.

This is not as straightforward in python. Yes, Jupyter notebooks are a great way of sharing analysis with other developers. But compiling to HTML/pdf, with code snippets removed, that looks nice enough for a non-technical stakeholder, I’ve found clunky using Jupyter notebooks. R markdown also has great tools to generate nice looking tables, not just plots.

I’ve been working with a python heavy team though, so have been trying to figure out how to generate R markdown style documents. In this post I’ll outline what I’ve been using to generate HTML reports in python, that look nice enough to share with non-technical stakeholders. The process uses a few tools.

The first step is to embed plots into a static HTML that you can then share with others. A great tool for this is plotly. Plotly has a to_html function (one of my amazing colleagues found this) which will write the plots as a HTML string, which you can then write to a file.

Leave a Comment