and images all sit in one document in your
Here’s an example notebook where I
explored predicting body fat percentage
with various regression models. Up top
here you see what’s called a text cell.
Cells are these guys and they can contain text
or code. If I double-click on the text
cell, I can edit the text in here. It’s
written in markdown, a text format with
syntax that renders to HTML. So for instance,
if I want to write a link, this is the
syntax for it, and if I render the
text, it’s a link. This is a code cell.
You can see here I’m importing some
packages like Numpy and Pandas. I can run
this cell and the code is executed the
same way as it is in the terminal or a
Python script. This command here
generated with matplotlib in the
notebook instead of a separate window.
If the cell returns some output, you see here.
For instance, data. head() returns an HTML
table displaying some of the data. Right
below here you see the data visualized
with a grid of scatter plots and
histograms. Notebooks even render math in
a text cells.
This is just an example of what you can
do with notebooks. You have your code,
documentation, visualizations, math, all in
Next, I’ll show you how to use notebooks
in your workflow. It should take about an
hour to get through the lesson, so see
you in the classroom!
Jupyter Notebook – First Demonstration
이제 제가 여러분께 소개해드릴
주피터 노트북. 노트북은 놀랍습니다
및 이미지는 모두 귀하의
다음은 내가 사용하는 노트북의 예입니다.
체지방률 예측 탐색
다양한 회귀 모델과 함께 위로 위로
여기에서 텍스트 셀이라고 하는 것을 볼 수 있습니다.
셀은 이 녀석들이며 텍스트를 포함할 수 있습니다.
또는 코드. 텍스트를 더블 클릭하면
여기에서 텍스트를 편집할 수 있습니다. 그것은
마크다운으로 작성된 텍스트 형식
HTML로 렌더링하는 구문. 예를 들어,
내가 링크를 쓰고 싶다면 이것은
그것에 대한 구문과 내가 렌더링하면
텍스트, 링크입니다. 이것은 코드 셀입니다.
여기에서 내가 일부를 가져오는 것을 볼 수 있습니다.
Numpy 및 Pandas와 같은 패키지. 나는 뛸 수있어
이 셀과 코드가 실행됩니다
터미널이나 같은 방법으로
파이썬 스크립트. 이 명령은 여기에서
별도의 창 대신 노트북.
셀이 일부 출력을 반환하면 여기에 표시됩니다.
예를 들어 데이터. head()는 HTML을 반환합니다.
일부 데이터를 표시하는 테이블. 오른쪽
여기 아래에서 시각화된 데이터를 볼 수 있습니다.
히스토그램. 노트북은 심지어 수학을 렌더링합니다.
이것은 당신이 할 수있는 일의 예일뿐입니다.
노트북으로 하세요. 당신은 당신의 코드를 가지고,
문서화, 시각화, 수학, 모든 것
다음으로 노트북 사용법을 알려드리겠습니다.
당신의 워크플로에서. 약 소요됩니다
수업을 마치는 데 한 시간이 걸리므로 참조하십시오.
교실에 있는 너!
What are Jupyter Notebooks?
Welcome to this lesson on using Jupyter notebooks. The notebook is a web application that allows you to combine explanatory text, math equations, code, and visualizations all in one easily sharable document. For example, here’s one of my favorite notebooks shared recently, binary black hole signals in LIGO open data detected by the LIGO experiment. You could download the data, run the code in the notebook, and repeat the analysis, in effect detecting the gravitational waves yourself! You can view a few more tutorial notebooks at Gravitational Wave Open Science Center homepage.
Notebooks have quickly become an essential tool when working with data. You’ll find them being used for data cleaning and exploration, visualization, machine learning, and big data analysis. Here’s an example notebook I made for my personal blog that shows off many of the features of notebooks. Typically you’d be doing this work in a terminal, either the normal Python shell or with IPython. Your visualizations would be in separate windows, any documentation would be in separate documents, along with various scripts for functions and classes. However, with notebooks, all of these are in one place and easily read together.
Notebooks are also rendered automatically on GitHub. It’s a great feature that lets you easily share your work. There is also http://nbviewer.jupyter.org/ that renders the notebooks from your GitHub repo or from notebooks stored elsewhere.
Notebooks are a form of literate programming proposed by Donald Knuth in 1984. With literate programming, the documentation is written as a narrative alongside the code instead of sitting off by its own. In Donald Knuth’s words,
Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.
After all, code is written for humans, not for computers. Notebooks provide exactly this capability. You are able to write documentation as narrative text, along with code. This is not only useful for the people reading your notebooks, but for your future self coming back to the analysis.
Just a small aside: recently, this idea of literate programming has been extended to a whole programming language, Eve.
How Notebooks Work
Jupyter notebooks grew out of the IPython project started by Fernando Perez. IPython is an interactive shell, similar to the normal Python shell but with great features like syntax highlighting and code completion. Originally, notebooks worked by sending messages from the web app (the notebook you see in the browser) to an IPython kernel (an IPython application running in the background). The kernel executed the code, then sent it back to the notebook. The current architecture is similar, drawn out below.