Jupyter Magic Commands

Cloudera Data Science Workbench's Scala and Python kernels are based on Jupyter kernels. Jupyter kernels support varying magic commands that extend the core language with useful shortcuts. This section details the magic commands (magics) supported by Cloudera Data Science Workbench.

Line magics begin with a single %: for example, %timeit. Cell magics begin with a double %%: for example, %%bash.

Python

In the default Python engine, Cloudera Data Science Workbench supports most line magics, but no cell magics.

Cloudera Data Science Workbench supports the shell magic !: for example, !ls -alh /home/cdsw.

Cloudera Data Science Workbench supports the help magics ? and ??: for example, ?numpy and ??numpy. ? displays the docstring for its argument. ?? attempts to print the source code. You can get help on magics using the ? prefix: for example, ?%timeit.

Cloudera Data Science Workbench supports the line magics listed at https://ipython.org/ipython-doc/3/interactive/magics.html#line-magics, with the following exceptions:
  • %colors
  • %debug
  • %edit
  • %gui
  • %history
  • %install_default_config
  • %install_profiles
  • %lsmagic
  • %macro
  • %matplotlib
  • %notebook
  • %page
  • %pastebin
  • %pdb
  • %prun
  • %pylab
  • %recall
  • %rerun
  • %save
  • %sc

Scala

Cloudera Data Science Workbench's Scala kernel is based on Apache Toree. It supports the line magics documented in the Apache Toree magic tutorial.