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

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.

主站蜘蛛池模板: 武义县| 娄底市| 新泰市| 定兴县| 大化| 香港 | 米林县| 横峰县| 宜都市| 双牌县| 福安市| 唐海县| 阿拉尔市| 吴忠市| 鄱阳县| 论坛| 沅陵县| 河北区| 老河口市| 重庆市| 永济市| 毕节市| 金华市| 襄垣县| 宜昌市| 东源县| 房产| 辽阳县| 河南省| 沾化县| 宾阳县| 长垣县| 台前县| 鹿邑县| 达拉特旗| 南康市| 白玉县| 伊宁县| 元江| 海兴县| 星子县|