Python Spark Certification Training usin... (6 Blogs) Become a Certified Professional

Jupyter Notebook Cheat Sheet : A Beginner’s Guide to Jupyter Notebook

Last updated on Sep 10,2019 5.1K Views
A Data Science Enthusiast with in-hand skills in programming languages such as... A Data Science Enthusiast with in-hand skills in programming languages such as Java & Python.

Jupyter Notebooks are a powerful way to write and iterate on your Python code for data analysis. Jupyter Notebook is built off of IPython and the Kernel runs the computations and communicates with the Jupyter Notebook front-end interface. This Jupyter Notebook Cheat Sheet will help you find your way around the well-known Notebook App, a subproject of Project Jupyter.

Jupyter Notebook Cheat Sheet

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 is used for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

This Jupyter Notebook Cheat Sheet is a guide to the Toolbar and the keyboard shortcuts used in Jupyter Notebook.

Jupyter Notebook Cheatsheet

Saving/Loading Notebooks

Let’s begin with the Saving or Loading of Jupyter Notebook

Loading-Notebook- Jupyter Notebook Cheat Sheet

  1. Create new Notebook
  2. Open an existing Notebook
  3. Make a Copy of the Current Notebook
  4. Save current Notebook
  5. Rename current Notebook
  6. Save current Notebook and record Checkpoint
  7. Revert Notebook to a previous checkpoint
  8. Preview of the printed Notebook
  9. Download Notebook as-
    • IPython Notebook
    • Python
    • HTML
    • Markdown
    • PDF
  10. Close Notebook & stop running scripts

Keyboard Shortcuts

The following are the most used keyboard shortcuts for a Jupyter Notebook running the Python Kernel. This list changes frequently. Check help->keyboard shortcuts in your notebook for the latest shortcuts.

CommandDescription
enterenter edit mode
Command + a; Command + c; Command + vselect all; copy; paste
Command + z; Command + yundo; redo
Command + ssave and checkpoint
Command + b; Command + ainsert cell below; insert cell above
Shift + Enterrun cell, select below
Shift + mmerge cells
Command + ]; Command + [indent; dedent
Ctrl + Enterrun cell
Option + Returnrun cell, insert cell below
Escapeenter command mode
Escape + d + ddelete selected cell
Escape + ychange cell to code
Escape + mchange cell to markdown
Escape + rchange cell to raw
Escape + 1change cell to Heading 1
Escape + nchange cell to heading n
Escape + bcreate cell below
Escape + aInsert cell above

Edit Cells

Edit-Notebook- Jupyter Notebook Cheat Sheet

  1. Cut the selected Cells to clipboard
  2. Copy cells from clipboard to current position
  3. Paste cells from clipboard above current cell
  4. Paste cells from clipboard below current cell
  5. Paste cells from clipboard on top of current cell
  6. Delete Cells
  7. Revert ‘Delete cells’ invocation
  8. Split up a cell from current position
  9. Merge current cell with the one above
  10. Merge current cell with the one below
  11. Move current cell up
  12. Move current cell down

Edit-Notebook- Jupyter Notebook Cheat Sheet

13. Adjust metadata underlying the current notebook

14. Find and replace in selected cells

15. Remove cell attachments

16. Copy attachments of current cell

17. Paste attachments of current cell

18. Insert image in selected cells

View Cells

View-Notebook- Jupyter Notebook Cheat Sheet

  1. Toggle display of Jupyter logo and filename
  2. Toggle display of toolbar
  3. Toggle line numbers in cells
  4. Toggle display of cell action icons: 
    • None
    • Edit metadata
    • Raw cell format
    • Slideshow
    • Attachments
    • Tags

Insert Cells

Insert-Notebook- Jupyter Notebook Cheat Sheet

Execute Cells

Execute Cell- Jupyter Notebook Cheat Sheet

  1. Add new cell above the current one
  2. Add new cell below the current one
  1. Run selected cells
  2. Run current cells down and create a new one below
  3. Run current cells down and create a new one above
  4. Run all cells
  5. Run all cells above the current cell
  6. Run all cells below the current cell
  7. Change the cell type of current cell
  8. Toggle, toggle scrolling and clear current outputs
  9. Toggle, toggle scrolling and clear all output

Magic Commands

Here are some of the commonly used Magic commands in jupyter Notebook.

Statement ExplanationExample
%magicComprehensively lists and explains magic functions%magic
%automagicWhen active, enables you to call magic functions without the ‘%’%automagic
%quickrefLaunch IPython quick reference%quickref
%timeTimes a single statementIn [561]: %time method = [a for a in data if b.startswith(‘http’)]
%pastebinPastebins lines from
your current session.
%pastebin 3 18-20 ~1/1-5
%debugEnters the interactive debugger%debug
%histPrint command input
and output history
%hist
%pdbAutomatically enter python debugger after any exception%pdb
%cpasteOpens up a special prompt for manually pasting Python code for execution%cpaste
%resetDelete all variables and
names defined in the
current namespace
%reset
%runRun a python script
inside a notebook
%run script.py
%who, %who_ls, %whosDisplay variables defined in the interactive namespace, with
varying levels of verbosity
%who, %who_ls, %whos
%xdelDelete a variable in the
local namespace. Clear any references to that variable
%xdel variable

Working with Different Programming Languages

Kernel-Notebook- Jupyter Notebook Cheat Sheet

Kernels provide computation and communication with front-end interfaces like the notebooks. Installing Jupyter Notebook will automatically install the IPython kernel.

  1. Interrupt kernel
  2. Restart kernel
  3. Interrupt kernel & clear all output
  4. Restart kernel & run all cells
  5. Connect back to a remote notebook
  6. Restart kernel & run all cells
  7. Run other installed kernels

Widgets

Widgets-Notebook- Jupyter Notebook Cheat Sheet

  1. Save notebook with interactive widget
  2. Clear notebook with interactive widget
  3. Download serialized state of all widget models in use
  4. Embed current widgets

Help

Ask for help-Notebook- Jupyter Notebook Cheat Sheet

  1. Walk through a UI tour
  2. List of built-in keyboard shortcuts
  3. Edit the built-in keyboard shortcuts
  4. Notebook help topics
  5. Description of markdown available in notebook
  6. Python help topics
  7. IPython help topics
  8. NumPy help topics
  9. SciPy help topics
  10. Matplotlib help topics
  11. SymPy help topics
  12. Pandas help topics
  13. About Jupyter Notebook

With this, we come to an end of Jupyter Notebook Cheat Sheet. To get in-depth knowledge, check out our interactive, live-onlineEdureka Python Data Science Certification Training here, that comes with 24*7 support to guide you throughout your learning period.Edureka’s Python course helps you gain expertise in Quantitative Analysis, data mining, and the presentation of data to see beyond the numbers by transforming your career into Data Scientist role. You will use libraries like Pandas, Numpy, Matplotlib, Scikit and master the concepts like Python Machine Learning Algorithms such as Regression, Clustering, Decision Trees, Random Forest, Naïve Bayes and Q-Learning and Time Series.

Comments
0 Comments

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.