Python tutorial: Get started with Jupyter Notebook

"Learn how to combine Python code, freeform text, mathematical formulas, and graphics in an interactive, shareable notebook"

Jupyter Notebooks let you combine code, comments, multimedia, and visualizations into an interactive document that can be shared, re-used, and re-worked.


Originally developed for data science applications written in Python, R, and Julia, Jupyter Notebooks are useful in all kinds of ways for all kinds of projects. You can use Jupyter Notebooks to share Python code and its output with third parties, to run code with live interactive feedback, or to systematically track and document the progress of your work.

In this post, we’ll walk through setting up Jupyter Notebook for Python, working with Jupyter’s various features, and sharing the results with others, whether they have Jupyter installed or not.

Jupyter Notebook installation and setup

The easiest way to create and work with Jupyter Notebooks for Python is to set up an instance of the Anaconda distribution of Python. Anaconda was created to make it easy to work with Python and its galaxy of data science tools, and it includes the Jupyter Notebook software as a standard-issue pack-in.

In addition to making Jupyter Notebooks easy to start up and use, Anaconda provides by default many of the other packages you’re likely to use in conjunction with Jupyter: Pandas, NumPy, TensorFlow, Matplotlib, and so on. Anaconda also makes it easier to do workaday things like manage virtual environments, keep Python packages up-to-date, and find good documentation for everything you’re working with.

One potential drawback to using Anaconda: If you’ve already built up a large Python workflow, you’ll have to migrate the work to the new Anaconda instance. If you’re not married to using your original setup, that’s the better choice in the long run. But if you need to stick with the environment you do have, you’ll need to install the Jupyter Notebook packages manually.

jupyter 00 IDG
The Anaconda distribution of Python comes preloaded with Jupyter Notebook. Running it is as easy as clicking an icon.
The good news is that a manual Jupyter Notebooks setup is easy too. Use pip to add Jupyter to a Python installation:
pip install jupyter
If you’re using Anaconda, the main Anaconda Navigator interface has a launcher for the Jupyter Notebook interface in the Home panel. Click it to start an instance of the Jupyter server, and your system’s default web browser will launch to access it.
If you’ve installed Jupyter manually with pip, you can launch it by typing jupyter notebook at a command line. Note that if you’re using Jupyter in a virtual environment for Python (a good idea if you’re not using Anaconda), you need to activate that environment before running that command.
Source: https://www.infoworld.com

Comments

Post a Comment