Jupyter Notebook Keyboard Shortcuts, new thread https://abs.twimg.com/emoji/v2/... draggable="false" alt="👌" title="Ok hand" aria-label="Emoji: Ok hand">!

We& #39;re trying to make this interactive; if you& #39;re on desktop, fork this project and follow along: https://notebooks.ai/rmotr-curriculum/interactive-jupyterlab-tutorial

https://notebooks.ai/rmotr-cur... class="Emoji" style="height:16px;" src=" https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Words with *stars* are concepts.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Words with [brackets] are keystrokes.

https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">
First off:

A Jupyter Notebook is an interactive code environment. It supports multiple languages, but the most common one is Python https://abs.twimg.com/emoji/v2/... draggable="false" alt="🐍" title="Schlange" aria-label="Emoji: Schlange">. We write code in *cells*, and the execution provides immediate feedback https://abs.twimg.com/emoji/v2/... draggable="false" alt="🏃‍♀️" title="Läuferin" aria-label="Emoji: Läuferin">:
One thing that confuse beginners is that Notebooks have two different *modes* https://abs.twimg.com/emoji/v2/... draggable="false" alt="🚦" title="Vertikale Verkehrsampel" aria-label="Emoji: Vertikale Verkehrsampel">:

https://abs.twimg.com/emoji/v2/... draggable="false" alt="✍️" title="Schreibende Hand" aria-label="Emoji: Schreibende Hand"> Edit mode: To write code.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> Command mode: run commands (this thread)

It& #39;s easy to differentiate them:
* In command mode https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> the cell is greyed out
* In edit mode https://abs.twimg.com/emoji/v2/... draggable="false" alt="✍️" title="Schreibende Hand" aria-label="Emoji: Schreibende Hand"> the cursor is blinking
To switch modes, we& #39;ll use:

* The [ESCAPE] key to go to https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode
* The [RETURN] key to go to https://abs.twimg.com/emoji/v2/... draggable="false" alt="✍️" title="Schreibende Hand" aria-label="Emoji: Schreibende Hand"> edit mode.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode is VERY important. It& #39;ll let you use *keyboard shortcuts* https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> to move a lot faster and be more efficient when using Notebooks.

The following tweets assume you& #39;re in https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode (make sure you hit that [ESCAPE] Key).

https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten"> Shortcuts Reference https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 1. Navigation Shortcuts https://abs.twimg.com/emoji/v2/... draggable="false" alt="🚀" title="Rakete" aria-label="Emoji: Rakete">

On https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode, hit:

* [UP] arrow key to navigate to cells above https://abs.twimg.com/emoji/v2/... draggable="false" alt="👆" title="Rückhand Zeigefinger nach oben" aria-label="Emoji: Rückhand Zeigefinger nach oben">
* [DOWN] arrow key to navigate cells below https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">

(If you& #39;re a vim user, you can also navigate with [J] & [K])
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 2. Shortcuts to create new cells https://abs.twimg.com/emoji/v2/... draggable="false" alt="📲" title="Mobiltelefon mit nach rechts zeigendem Pfeil auf der linken Seite" aria-label="Emoji: Mobiltelefon mit nach rechts zeigendem Pfeil auf der linken Seite">

* Press [A] to create a cell "[A]bove" the current selected cell https://abs.twimg.com/emoji/v2/... draggable="false" alt="👆" title="Rückhand Zeigefinger nach oben" aria-label="Emoji: Rückhand Zeigefinger nach oben">

* Press [B] to create a cell "[B]elow" the current cell https://abs.twimg.com/emoji/v2/... draggable="false" alt="👇" title="Rückhand Zeigefinger nach unten" aria-label="Emoji: Rückhand Zeigefinger nach unten">
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 3. Shortcut to delete cells https://abs.twimg.com/emoji/v2/... draggable="false" alt="☠️" title="Totenkopf" aria-label="Emoji: Totenkopf">

Use the [UP] and [DOWN] arrow keys to move to the cell that you want to delete and hit the [D] key *2 times*. You have to chain the key presses quickly: [D] [D]
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 4. Shortcut to undo your previous command https://abs.twimg.com/emoji/v2/... draggable="false" alt="🙅" title="Person gesturing not ok" aria-label="Emoji: Person gesturing not ok">

Did you incorrectly delete a cell https://abs.twimg.com/emoji/v2/... draggable="false" alt="😱" title="Vor Angst schreiendes Gesicht" aria-label="Emoji: Vor Angst schreiendes Gesicht">? Don& #39;t worry! You can just undo that action.

https://abs.twimg.com/emoji/v2/... draggable="false" alt="✨" title="Funken" aria-label="Emoji: Funken"> To undo your previous command, use the [Z] key https://abs.twimg.com/emoji/v2/... draggable="false" alt="✨" title="Funken" aria-label="Emoji: Funken">

(To remember this shortcut, think about ctrl+[Z])
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 5. Shortcuts to execute code https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔥" title="Feuer" aria-label="Emoji: Feuer">

(this works on both edit https://abs.twimg.com/emoji/v2/... draggable="false" alt="✍️" title="Schreibende Hand" aria-label="Emoji: Schreibende Hand"> and command https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> modes)

To execute code, keep the [CTRL] key pressed, and hit the [RETURN] key. The shortcut is: [CTRL + RETURN]

Extra https://abs.twimg.com/emoji/v2/... draggable="false" alt="🍰" title="Teekuchen" aria-label="Emoji: Teekuchen">: use [SHIFT + RETURN] to execute the cell and navigate to the cell below.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 6. Copy and paste cells https://abs.twimg.com/emoji/v2/... draggable="false" alt="🛠" title="Hammer und Schraubenschlüssel" aria-label="Emoji: Hammer und Schraubenschlüssel">

On https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode, hit the [C] key to [C]opy a cell. Navigate to the position you want to paste it and hit the [V] key. It& #39;ll be placed below.

(remember this command because of ctrl+c & ctrl+v).
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 7. Shortcut to change cell type

On https://abs.twimg.com/emoji/v2/... draggable="false" alt="⚡️" title="Hochspannungszeichen" aria-label="Emoji: Hochspannungszeichen"> command mode:

* Hit the [M] key to switch to [M]arkdown mode https://abs.twimg.com/emoji/v2/... draggable="false" alt="📝" title="Memo" aria-label="Emoji: Memo">.
* Hit the [Y] key to go back to p[Y]thon code https://abs.twimg.com/emoji/v2/... draggable="false" alt="🐍" title="Schlange" aria-label="Emoji: Schlange">.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 8. Shortcut to interrupt the kernel

Did you get stuck on an infinite loop https://abs.twimg.com/emoji/v2/... draggable="false" alt="😵" title="Benommenes Gesicht" aria-label="Emoji: Benommenes Gesicht">?

Hit the [I] key two times to [I]nterrupt the kernel. Chain the two key presses quickly: [I] [I]

(similar to the delete command we saw before).
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 9. Shortcut to restart the kernel https://abs.twimg.com/emoji/v2/... draggable="false" alt="🎁" title="Verpacktes Geschenk" aria-label="Emoji: Verpacktes Geschenk">

Sometimes, there& #39;s no other way than just restarting the whole kernel. Similar to Interrupt, hit the [0] (zero) key two times quickly: [0] [0] (again, that& #39;s a zero).
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🔑" title="Schlüssel" aria-label="Emoji: Schlüssel"> 10. Merge multiple cells https://abs.twimg.com/emoji/v2/... draggable="false" alt="👯‍♂️" title="Männer mit Hasenohren" aria-label="Emoji: Männer mit Hasenohren">

(this is an less known feature https://abs.twimg.com/emoji/v2/... draggable="false" alt="💎" title="Edelstein" aria-label="Emoji: Edelstein">)

Select the cells that you want to merge and, while maintaining [SHIFT] pressed, hit the [M] key: [SHIFT + M]

Isn& #39;t that amazing? https://abs.twimg.com/emoji/v2/... draggable="false" alt="🍰" title="Teekuchen" aria-label="Emoji: Teekuchen">
Useful trick: if you ever forget any of these commands https://abs.twimg.com/emoji/v2/... draggable="false" alt="😢" title="Weinendes Gesicht" aria-label="Emoji: Weinendes Gesicht">, use the command palette to search for them. The keyboard shortcut will appear next to the command https://abs.twimg.com/emoji/v2/... draggable="false" alt="😁" title="Grinsendes Gesicht mit lächelnden Augen" aria-label="Emoji: Grinsendes Gesicht mit lächelnden Augen">.
You can follow @rmotr_com.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: