(TIL) Jupyter: Output of all variables

less than 1 minute read

If you try to see the output of more variables without explicitly writing print in front of each, only the last one gets outputted. With this, you get them all:

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

If you want to set this behaviour for all instances of Jupyter, simply create a file ~/.ipython/profile_default/ipython_config.py with the lines below.

c = get_config()

# Run all nodes interactively
c.InteractiveShell.ast_node_interactivity = "all"

Via Martina Pugliese and dataquest.io.

Comments