官术网_书友最值得收藏!

Jupyter notebook

Now, let's explore Jupyter notebook, the Python programming tool we will use for most of this book. Go back to the Home tab and click the Launch button inside Jupyter icon. A new tab should open in your default browser that looks similar to the following screenshot:

This is the Files tab of the Jupyter application, where you can navigate your computer's directories to launch a new Jupyter notebook, open an existing one, or manage your directories.

Let's create a new Jupyter notebook. Locate the New drop-down menu on the upper right of the console and click it. In the drop-down menu, click Python 3. Another tab will open what looks like the following screenshot:

 

 

 

 

 

The box labeled with In is called a cell. The cell is the functional unit of Python programming inside of Jupyter. You enter your code in a cell and then click run to execute it. After you see the result, you can create a new cell and continue with your workflow, building on the previous results if you so choose.

Let's try an example. Click in the cell body, and type the following lines:

message = 'Hello World!'
print(message)

Then, find the Play button on the top toolbar and click it. You should see the Hello World! message immediately following the cell. You will also see a new cell below the text. This is the way Jupyter works.

Now, in the new cell, enter the following:

modified_message = message + ' Also, Hello World of Healthcare Analytics!'
print(modified_message)

Again, click the Play button. You should see the modified message under the second cell and the appearance of a third cell. Notice that the second cell is aware of what the message variable contains, even though it was assigned in the first cell. Jupyter remembers every command entered into the console for each session. To clear the memory, you must shut down and restart the kernel:

Now, let's end the current session. Go back to the Home tab in your browser. Click on the Running tab in the upper left. Under the Notebooks menu, you should see that Untitled.ipynb is running. Click the Shutdown button to the right and the notebook will disappear.

That's enough Jupyter for now. You will get more closely acquainted with it in the coming chapters.

主站蜘蛛池模板: 汝州市| 木兰县| 遂溪县| 明溪县| 日照市| 成都市| 建宁县| 偏关县| 双峰县| 南郑县| 阜平县| 三原县| 长寿区| 岳阳市| 普陀区| 乌鲁木齐县| 涟水县| 揭东县| 虞城县| 多伦县| 攀枝花市| 青岛市| 洛南县| 海安县| 安远县| 循化| 女性| 池州市| 灵武市| 章丘市| 离岛区| 商都县| 应城市| 大宁县| 九台市| 荆门市| 饶平县| 合江县| 琼海市| 若尔盖县| 盈江县|