40 Jupyter Notebook Tips, Tricks, and Shortcuts for Data Science

Boost your data science skills with these 40 amazing Jupyter Notebook tips tricks and shortcuts for easy navigation efficient editing and seamless code execution for a more productive workflow

40 Jupyter Notebook Tips, Tricks, and Shortcuts for Data Science

If you are a data scientist, you are probably well aware of Jupyter Notebook, a powerful tool for data analysis, visualization, and exploration. Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It supports over 40 programming languages, including Python, R, and Julia.

In this blog post, we will share 40 Jupyter Notebook tips, tricks, and shortcuts that will help you to become more productive and efficient in your data science work.

Switch between edit and command mode: Press Esc to switch to command mode and Enter to switch to edit mode. In command mode, you can navigate the notebook using keyboard shortcuts, while in edit mode, you can edit the cells.

Add a new cell: Press B to add a new cell below the current cell and A to add a new cell above the current cell.

Delete a cell: Press D twice to delete the current cell.

Copy and paste a cell: Press C to copy the current cell and V to paste it.

Undo and redo: Press Z to undo the last action and Shift + Z to redo.

Move up and down: Press J to move down and K to move up.

Indent and unindent: Press Tab to indent and Shift + Tab to unindent.

Cell Types

Code cell: Use code cells to write and execute code.

Markdown cell: Use markdown cells to write text, add headings, lists, links, images, and more.

Raw cell: Use raw cells to write text that should not be processed by Jupyter Notebook.

Heading: Use # to create headings of different levels. For example, # Heading 1, ## Heading 2, ### Heading 3, and so on.

List: Use - or * to create a bulleted list and 1. to create a numbered list.

Link: Use [link text](URL) to create a link. For example, [Google](https://www.google.com).

Code Execution

Run a cell: Press Shift + Enter to run the current cell and move to the next cell.

Run a cell and insert a new cell below: Press Alt + Enter to run the current cell and insert a new cell below.

Run a cell and stay in the same cell: Press Ctrl + Enter to run the current cell and stay in the same cell.

Interrupt a running cell: Press I, I to interrupt a running cell.

Restart the kernel: Press 0, 0 to restart the kernel.

Clear the output: Press O, O to clear the output of all cells.

Keyboard Shortcuts

Show keyboard shortcuts: Press H to show a list of keyboard shortcuts.

Find and replace: Press F to open the find and replace dialog.

Toggle line numbers: Press L to toggle line numbers in code cells.

Toggle cell output: Press O to toggle the output of a cell.

Toggle scrolling: Press S to toggle scrolling in a cell.

Toggle line wrapping: Press W to toggle line wrapping in a cell.

Toggle input/output: Press Shift + O to toggle the input and output of a cell.

Magic Commands

List of magic commands: Use %lsmagic to list all available magic commands.

Timing: Use %time to time the execution of a single statement and %timeit to time the execution of multiple statements.

Debugging: Use %debug to enter the interactive debugger.

Help: Use %help or ? to get help on a magic command or object.

Load external code: Use %load to load external code into a cell.

Write to a file: Use %writefile to write the contents of a cell to a file.

Extensions

List of extensions: Use $ jupyter nbextension list to list all installed extensions.

Enable an extension: Use $ jupyter nbextension enable extension_name to enable an extension.

Disable an extension: Use $ jupyter nbextension disable extension_name to disable an extension.

Sharing and Collaboration

Export to different formats: Use File > Download as to export the notebook to different formats, such as HTML, PDF, Markdown, and more.

Share on GitHub: Use File > Save as to save the notebook as a .ipynb file and then push it to a GitHub repository.

Collaborate on Google Colab: Use Google Colab to collaborate on notebooks in real-time with other data scientists.

Publish on Jupyter Notebook Viewer: Use Jupyter Notebook Viewer to publish and share your notebooks with others.

Conclusion

Jupyter Notebook is a powerful tool for data science, and these 40 tips, tricks, and shortcuts will help you to become more productive and efficient in your work. Whether you are a beginner or an experienced data scientist, these tips will save you time and help you to focus on what really matters: analyzing and visualizing data. So, start using these tips today and take your data science skills to the next level!


About Saturn Cloud

Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Request a demo today to learn more.