Magic Commands

Magic commands generally known as magic functions are special commands in IPython that provide special functionalities to users like modifying the behavior of a code cell explicitly, simplifying common tasks like timing code execution, profiling, etc. Magic commands have the prefix ‘%’ or ‘%%’ followed by the command name. There are two types of magic commands:

  1. Line Magic Commands
  2. Cell Magic Commands

Useful IPython magic commands

In this article, we will cover IPython Magic commands/functions and discuss various types of magic commands available. In this article we will be using Jupyter Notebook to execute the magic commands first, we look at what are Magic functions and why we use them, then different types of magic functions followed by examples. There are a lot of magic functions but in this article, we discuss the most commonly used magic functions.

Jupyter Notebook

The Jupyter Notebook is the original web application for creating and sharing computational documents that contain live code, equations, visualizations, and narrative text. It offers a simple, streamlined, document-centric experience. Jupyter has support for over 40 different programming languages and Python is one of them.

Similar Reads

Magic Commands

Magic commands generally known as magic functions are special commands in IPython that provide special functionalities to users like modifying the behavior of a code cell explicitly, simplifying common tasks like timing code execution, profiling, etc. Magic commands have the prefix ‘%’ or ‘%%’ followed by the command name. There are two types of magic commands:...

Line Magic Commands

Line magic commands are used to provide a special functionality to a single line of code, line magic commands begin with ‘%’ followed by the line command. To check the available magic commands run ‘%lsmagic’ this command will show all the magic commands, as of now there are 97 line magic commands which are as follows:...

Cell Magic Commands

...

Example of Cell Magic Functions

...