Originally published at http://www.ds4n6.io.

If you want to change the font size, for instance, you can do it through overriding templates ( docs, base templates), but it can get complex. So the easiest way is to convert to LaTeX first, do some simple replacements, and then convert the resulting LaTeX to pdf via the pdflatex utility:

Requirements:

  • texlive-xetex must be installed in the system (Ubuntu installation: apt-get install texlive-xetex texlive-generic-extra)

Refs:

Originally published at http://www.ds4n6.io.

Often times you will be working in different notebooks (with different kernels) and you will want to share a variable from one notebook to the other.

In order to share a variable (e.g. string, dict, Series, DataFrame, etc.) just use the %store magic:

On the “sending” side:

On the “receiving” side:

That’s it!

Read more about the %store magic here:

https://ipython.readthedocs.io/en/stable/config/extensions/storemagic.html

Originally published at http://www.ds4n6.io.

Refs:

Originally published at http://www.ds4n6.io.

Say you have been working a lot in your current notebook, you have lots of DataFrames and Series that get a long time to be computed, and you want to make sure you recover quickly if, for some reason, your Session (Kernel) dies.

The answer is “dill”.

Installation:

Save a Notebook session:

Restore a Notebook session:

Caveats:

  • Fails when there are generators.
  • If you have pyodbc connection objects hanging around, you’ll need to close them and then set them all to None otherwise, you get a “TypeError: can’t pickle pyodbc.Connection objects” error.
  • The notebook state does not include graphs that were generated by your code, so you’ll need to rerun the cells to bring these back.

Refs:

https://stackoverflow.com/questions/34342155/how-to-pickle-or-store-jupyter-ipython-notebook-session-for-later

DS4N6

Community focused on bringing Data Science & Artificial Intelligence to the fingertips of the average Forensicator and promoting advances in the field.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store