Jupyter: Difference between revisions
Jump to navigation
Jump to search
| (2 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
=Keyboard shortcuts= | =Keyboard shortcuts= | ||
First select a cell (click left from the editing area), then: | |||
* dd delete | * <shift>j Select next cell too | ||
* dd delete | |||
* a paste a new empty cell above the current cell | * a paste a new empty cell above the current cell | ||
* b paste a new empty cell below the current cell | * b paste a new empty cell below the current cell | ||
* y change cell type to code | * y change cell type to code | ||
* m change cell type to | * m change cell type to markdown | ||
* c copy | * c copy | ||
* v paste copied cell below current cell | * v paste copied cell below current cell | ||
* h show help | * h show help | ||
* <esc> Leave cell context | |||
* <enter> Enter cell context | |||
* <shift><enter> Run cell code or render markdown | |||
=Other tricks= | =Other tricks= | ||
| Line 19: | Line 23: | ||
E.g. to install a new module: | E.g. to install a new module: | ||
!pip install <modulename> | !pip install <modulename> | ||
;Time a command with output | |||
:time <commmand> | |||
;Time a command running it 100000 times, no output | |||
:%timeit <commmand> | |||
Latest revision as of 11:58, 18 March 2021
The jupyter notebook is a great tool for experimenting with python code and document it in one go.
A notebook consists of cells that have Code or Markdown text in it.
Keyboard shortcuts
First select a cell (click left from the editing area), then:
- <shift>j Select next cell too
- dd delete
- a paste a new empty cell above the current cell
- b paste a new empty cell below the current cell
- y change cell type to code
- m change cell type to markdown
- c copy
- v paste copied cell below current cell
- h show help
- <esc> Leave cell context
- <enter> Enter cell context
- <shift><enter> Run cell code or render markdown
Other tricks
To execute shell command start the cell with a !
E.g. to install a new module:
!pip install <modulename>
- Time a command with output
- time <commmand>
- Time a command running it 100000 times, no output
- %timeit <commmand>