3 Comments
Dec 20, 2023Liked by James O'Reilly

One problem Iโ€™ve had with using Jupyter for calcs is that the output pdf (using nbconvert) does not look like an excel sheet โ€œreportโ€ (mainly the lack of header and borders). So I always get comments about my calcs not being aesthetically consistent with others. Iโ€™ve been able to add a header using an html table in a markdown cell, any ideas for borders? Or other template features to make the output more familiar to reviewers?

Expand full comment
author
Dec 20, 2023ยทedited Dec 20, 2023Author

I've run into similar comments in the past. Personally, I think it's a trivial thing for reviewers to focus on but I understand the desire for consistency. You can add custom CSS and html styling to your Jupyter notebooks for borders and headers, but it's a big waste of energy and a deep rabbit hole, especially if you want to make this a consistent global formatting style on all of your notebooks.

If you really need to add the styling to satisfy a reviewer, I'd manually paste in the Excel headers as an image. I know that's not a clean solution but it's a much better use of your time. If you must dig deeper, check this out - https://jupyter-notebook.readthedocs.io/en/stable/custom_css.html

One other suggestion is using tabulate (https://github.com/astanin/python-tabulate). It's a package for neatly tabulating output data. Sometimes it's more appropriate than a HTML render but it might not be applicable to your use case.

Expand full comment
Dec 21, 2023Liked by James O'Reilly

"but it's a big waste of energy and a deep rabbit hole"... yes, it probably is! I'll probably stick to the manual workout when needed. Thanks!

Expand full comment