Skip to content
On this page

Jupyter Howto

On this page

Jupyter Howto

Display all line outputs in a cell

  • Place this code in a Jupyter cell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
  • Add dislplay(variable) for each variable you want to show. Import from from IPython.display import display
  • For permanent effect (or when using Jupyter Lab), add following code to the file C:\Users\USERNAME\.ipython\profile_default\ipython_config.py:
c.InteractiveShell.ast_node_interactivity = "all"

or

c = get_config()
c.InteractiveShell.ast_node_interactivity = "all"

Debugging

import pdb;
pdb.set_trace()

or

!pip install -Uqq ipdb
import ipdb
ipdb.set_trace()

with

  1. l(ist) Show the current location in the file
  2. h(elp) Show a list of commands, or find help on a specific command
  3. q(uit) Quit the debugger and the program
  4. d(own) [count] Move the current frame count (default one) levels down in the stack trace (to a newer frame).
  5. u(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame).
  6. b(reak)
  7. c(ontinue) Quit the debugger, continue in the program
  8. n(ext) Go to the next step of the program
  9. p(rint) Print variables
  10. s(tep) Step into a subroutine
  11. r(eturn) Return out of a subroutine
  12. unt(il) [lineno]
  13. j(ump) [lineno]

See:

References

Edit this page
Last updated on 3/7/2023