Hi Reader,
If you spend a lot of time in Jupyter Notebook, the easiest way to increase your productivity is by using the built-in keyboard shortcuts.
Unlike most applications, Jupyter's keyboard shortcuts are easy to remember since they often only require a single key.
Below, I'll cover the most useful keyboard shortcuts (including some hidden gems π) so that you can speed up your workflow today!
I'm focusing on Jupyter Notebook in this email, but I've made a note of any differences for JupyterLab.
Before we begin, it's critical that you're aware of the difference between Command Mode and Edit Mode, since different shortcuts work for each mode.
In Edit Mode, there's a blinking cursor and a green border, whereas in Command Mode, there's a gray border with a blue bar:
To change modes:
Note: JupyterLab uses a blue border for Edit Mode.
Here are the keyboard shortcuts you should learn first, because you'll use these the most:
Command Mode:
You can use dd (meaning "d" twice) to delete cells, but I just use x instead.
Edit Mode:
Either Mode:
These shortcuts are not as well-known, but will help you to become a true power user:
Command Mode:
p: Open the command palette. You can scroll or search through commands, then select an action and hit Enter to run it.
JupyterLab: Cmd+Shift+c (Mac), Ctrl+Shift+c (Windows)
o: Toggle between hiding and showing the output for selected code cells. This is useful when the output is taking up too much of your screen.
JupyterLab: This shortcut is not available. Instead, open the command palette and search for "Collapse Selected Outputs."
z: Undo cell deletion. You can undo multiple deletions, and each cell will go back to its original position. It works even if you have done other work since the deletions!
Edit Mode:
Cmd+/ (Mac), Ctrl+/ (Windows): Toggle between commented and uncommented code. You can apply this to multiple lines at once by first selecting those lines.
Shift+Tab: View the docstring for a function. Hit Shift+Tab three more times to open the docstring in a new pane.
JupyterLab: Hit Shift+Tab once.
Multi-cursor support: Hold down Option (Mac) or Alt (Windows), then click your mouse and drag up or down. This allows you to edit multiple lines at once.
How helpful was todayβs tip?
If you enjoyed this issue, please forward it to a friend! Takes only a few seconds, and it really helps me out π
See you next Tuesday!
- Kevin
P.S. Did someone awesome forward you this email? Sign up here to receive data science tips every week!
Join 25,000+ intelligent readers and receive AI tips every Tuesday!
Hi Reader, Until 8 PM ET tonight, you can get the All-Access Pass for $99: Here's everything you need to know: Access all existing courses for one year ($700+ value) Includes new courses launched during your subscription Includes e-book version of Master Machine Learning (coming soon) Additional discounts available Lock in this price forever 30-day refund policy Get the Pass for $99 Questions? Please let me know! - Kevin
Hi Reader, I wanted to share with you three limited-time resources for improving your Python skills... 1οΈβ£ Algorithm Mastery Bootcamp π₯Ύ Are you looking for an intense, 12-day Python bootcamp? My friend Rodrigo GirΓ£o SerrΓ£o is running a new Algorithm Mastery Bootcamp, and it starts in just 5 days! In the bootcamp, you'll solve 24 real programming challenges and participate in daily live sessions to discuss and compare solutions. It's a great way to strengthen your problem-solving muscles πͺ I...
Hi Reader, Last week, I launched the All-Access Pass, which gives you access to ALL of Data School's courses for one year. Through Black Friday, you can buy the pass for $99, after which the price will increase. Here are the included courses: Build an AI chatbot with Python ($9) Create your first AI app in 60 minutes using LangChain & LangGraph! β‘ Build AI agents with Python ($99) Develop the skills to create AI apps that can think and act independently π€ Conda Essentials for Data Scientists...