# Jupyter Notebook

## Magics

`%lsmagic`

will show all the magics, including line magics and cell magics.- Line magics are magics start with one
`%`

; - Cell magics are magics that can be used in the whole cell even with line breaks, where the cell should start with
`%%`

.

- Line magics are magics start with one
`%env`

can be used when setting environment variables inside the notebook.`%env MONGO_URI=localhost:27072`

`%%bash`

is a cell magic that allows bash commands in the cell.`%%bash ls pip install datahubxyz`

`%%time`

enables timing of functions.`%%time for i in range(1000): i*i`

`%timeit`

is the corresponding line magic which times the function of the corresponding line.

## Documentation

`?functionname`

(`IPython`

,`Jupyter`

): doc string of the function with better formatting`dir(modulename)`

(`Python`

,`IPython`

,`Jupyter`

): to get the list of attributes of the module.`modulename.functionname.__doc__`

(`Python`

,`IPython`

,`Jupyter`

): to get the doc string of the function.

Planted:
by L Ma;

References:

Similar Articles:

L Ma (2018). 'Jupyter Notebook', Datumorphism, 06 April. Available at: https://datumorphism.leima.is/wiki/tools/jupyter/.