Loading Runtime
How do they work?
Notebooks are excellent tools for Data Analysis, Data Science, and general Scientific Computing because of the way that they allow for textual explanation and documentation to be presented alongside code.
Text Cells are written primarily in markdown but most editors also allow for html, equations (LaTeX), images, tables, and embedded videos as well.
Code Cells usually showcase Python code, but notebooks exist for many different programming languages. Code cells have two main sections the "input" section where the code is typed, and a lower "output" section. The output section will display the result of all print()
statements as well as the last value to be returned in the code cell –so long as the returned value is not followed by any other print statements. This behavior takes some getting used to, but you'll catch onto it as you use them.
When a code cell is executed, a number will appear in the top-left corner of the code cell. This is the "execution count." The execution count tells you the order in which the code cells have been run. This is important to pay attention to as many times the behavior of the notebook is dependent on the order in which the code cells are executed.
It's a best practice that –if executed from top to bottom– the notebook will always have the same behavior and demonstrate the same results. The goal is that work be "reproducible" so that it can be correctly interpreted by anyone that it is shared with.
What's the difference between an "IPython" notebook and a "Jupyter" notebook?
Python-specific notebooks are sometimes referred to as IPython Notebooks (short for Interactive Python) and files generated from these applications have the file extension .ipynb
.
IPython notebooks are a predecessor to the now very popular Jupyter Notebook. Jupyter is the language-agnostic version of IPython. Many different programming languages can be used in Jupyter notebooks. In fact, the name Jupyter is a mashup of the three most commonly supported languages –Julia, Python, and R.
Check out some cool notebooks to see their potential!
There's are some really great resources on GitHub for discovering cool notebooks. Take a look at a couple of these to get an idea about how truly versatile these documents are.
- ipython-wiki repository - has compiled a list of interesting notebooks on a variety of topics.
- Project Jupyter - has a great repository as well.
- GitHub Trending - Can also be used to find some of the notebooks that are the hottest right now. These tend to be notebooks that demonstrate some of the biggest current developments in Data Science and Machine learning, so check in on this page often to keep up to date.
Some of the links in these repos are broken. Try and ignore those and still find something cool.
How to open a notebook Google Colab with a single click.
If you want to not just view a notebook on GitHub but get it open quickly and play around with it, maybe run or tweak some of the code cells, Try using the Open in Colab Google Chrome Extension. You'll need a Google Drive account to get the most out of Google Colab.
Once you've got the extension installed, just navigate within GitHub to the specific notebook that you want to open. You'll need to be on the page where GitHub will show you a preview of the notebook. The file you're looking at should have the extension .ipynb
for example:
This notebook which shows you how to generate images using DALL-E using Python
Looks like this:
And should open with a single click of the chrome extension once you're on the correct page: