1 00:00:00,210 --> 00:00:05,340 In this session we will talk about the Jupiter notebook application. 2 00:00:05,760 --> 00:00:15,120 When you install the latest version of Titan from the anaconda distribution Web site it includes Python 3 00:00:15,990 --> 00:00:21,510 The Jupiter notebook and a number of useful packages. 4 00:00:21,510 --> 00:00:31,050 Let us now discuss about the Jupiter notebook application a Jupiter notebook application is a solver 5 00:00:31,380 --> 00:00:40,140 client application that allows us to edit and run notebook documents via a web browser. 6 00:00:41,160 --> 00:00:45,530 And what is a notebook document a notebook. 7 00:00:45,570 --> 00:00:54,570 Document is just like a file that letters write and execute Python code in a web browser. 8 00:00:56,380 --> 00:01:04,450 And a Jupiter notebook app can be executed on a local desktop requiring no internet access. 9 00:01:04,650 --> 00:01:15,390 Odd it can be installed on a remote cell but and access through the Internet the Jupiter notebook web 10 00:01:15,450 --> 00:01:19,170 application combines three components. 11 00:01:19,170 --> 00:01:27,760 One is the notebook web application and then we have a Kernan and notebook dock. 12 00:01:29,070 --> 00:01:38,100 When you launch the Jupiter notebook application the first component that we see in the web browser 13 00:01:38,580 --> 00:01:48,230 is the Jupiter notebook dashboard and the dashboard is like a control panel showing local files. 14 00:01:49,250 --> 00:01:57,200 Say we have files like data types dot IP why and B and then list dot IP why and. 15 00:01:57,680 --> 00:02:07,520 The Notebook dashboard allows us to open the notebook documents here or shutting down the kernels. 16 00:02:07,520 --> 00:02:17,660 So what is a cone in a notebook kernel is a computational engine that executes decode contained in a 17 00:02:17,660 --> 00:02:19,550 notebook document. 18 00:02:19,550 --> 00:02:28,610 So the notebook document is a file whereas the Kernan is a process. 19 00:02:28,610 --> 00:02:39,110 The kernel performs the computation and produces the results so the kernel it just seems snippet of 20 00:02:39,200 --> 00:02:51,500 code from the notebook interface executes them and sent the output or possible errors back to the notebook 21 00:02:52,190 --> 00:02:57,750 interface and the Jupiter notebook is not only for Python. 22 00:02:58,160 --> 00:03:07,390 It can be used for other programming languages like odd Julia matlab and other languages as well. 23 00:03:07,970 --> 00:03:18,420 And all the files the notebook documents are saved in Jason formatted text file with this extension. 24 00:03:18,420 --> 00:03:22,700 Dot IP y and be next. 25 00:03:22,700 --> 00:03:29,970 I'm going to now show how to launch the Jupiter notebook server from the command line. 26 00:03:30,230 --> 00:03:41,720 So at the command prompt you need to type Jupiter space notebook and then hit enter in your Windows 27 00:03:41,720 --> 00:03:42,970 system. 28 00:03:43,040 --> 00:03:50,960 If this is your first time it is going to take a while after you give this command your browser will 29 00:03:51,080 --> 00:03:55,170 open to the notebook dashboard automatically. 30 00:03:55,250 --> 00:03:58,730 If this does not happen automatically. 31 00:03:59,480 --> 00:04:03,590 So as you can see here the highlighted text. 32 00:04:03,590 --> 00:04:09,650 Copy and paste this you are well into your browser when you connect for the first time. 33 00:04:09,830 --> 00:04:21,170 So I'm gonna copy this you order along with the token key and paste it in the browser and after I have 34 00:04:21,170 --> 00:04:25,220 pasted there you are all provided in the command line. 35 00:04:25,220 --> 00:04:34,130 Here is the notebook dashboard and the notebook dashboard serves as a home page for the notebook. 36 00:04:34,130 --> 00:04:42,290 As we have discussed before its main purpose is to display the notebooks and the files in the current 37 00:04:42,290 --> 00:04:43,260 directory. 38 00:04:43,280 --> 00:04:54,410 By default the files tab here is open and when you are in this tab you can display the different files 39 00:04:54,710 --> 00:04:56,130 that you have done. 40 00:04:57,260 --> 00:05:09,650 As we can see here next is the running tab and the running tab is used to see all of the running notebooks 41 00:05:09,980 --> 00:05:19,800 along with their directories so currently I have no notebook open and so there are no files that are 42 00:05:19,800 --> 00:05:20,870 running. 43 00:05:21,240 --> 00:05:26,190 Create a notebook or a file to start working. 44 00:05:26,190 --> 00:05:33,530 So for that click on the button you here and I have two kernels installed. 45 00:05:33,570 --> 00:05:42,860 One is for Python 2 and the other is for Python 3 and I want to create a file for Python 3. 46 00:05:42,990 --> 00:05:45,160 So let's choose Python 3. 47 00:05:45,240 --> 00:05:58,620 And here is the notebook document and the notebook document contains the menu but the tool but and since 48 00:05:59,370 --> 00:06:08,380 the cells that we see here so let us first give a title to our notebook document. 49 00:06:08,380 --> 00:06:20,640 So I'm going to see Jupiter notebook class and then click on green name. 50 00:06:20,640 --> 00:06:24,500 So here we have a title for the notebook. 51 00:06:24,720 --> 00:06:29,130 Next coming to the court in here. 52 00:06:29,230 --> 00:06:34,580 These courses are where you place your python code that you want to run. 53 00:06:34,920 --> 00:06:42,900 And mark down cells are used for providing descriptions of the code and the steps that we are taking 54 00:06:43,680 --> 00:06:46,640 and the type of discipline. 55 00:06:47,160 --> 00:06:56,650 If you want to enter code that is Python caught in a cell by default decode type would be code. 56 00:06:56,850 --> 00:07:02,920 If you want to enter text into your code sir you can choose the type. 57 00:07:02,970 --> 00:07:14,260 Mark down so let's choose the type as code for this cell and all code that you write in a notebook will 58 00:07:14,260 --> 00:07:15,720 be in this quarter. 59 00:07:16,450 --> 00:07:25,660 We can write single lines or entire loops to complete functions let us write a print function in this 60 00:07:25,660 --> 00:07:26,240 code. 61 00:07:26,980 --> 00:07:34,350 Hello world is the text that I want to display using the print function. 62 00:07:34,350 --> 00:07:46,050 So in order to execute the code in this cell you can go to the menu bird here and click on say and then 63 00:07:46,230 --> 00:07:48,410 run cells. 64 00:07:48,420 --> 00:07:55,880 So here you have your output displayed just below the input set. 65 00:07:56,240 --> 00:07:59,920 So here we have output displayed. 66 00:08:00,170 --> 00:08:08,390 We can change the code in an input cell and read on the cell as often as we like. 67 00:08:08,390 --> 00:08:21,160 So for example I want to print the sum of two and three and then run this cell go to cell here at the 68 00:08:21,160 --> 00:08:25,390 top and run choose run cells. 69 00:08:25,410 --> 00:08:29,100 So here we have the output displayed in the output set. 70 00:08:29,670 --> 00:08:39,870 And if you want to create a new cell you can click on shift and enter together to create a new set and 71 00:08:39,900 --> 00:08:48,120 you can also use the buttons shift and enter in order to execute decode innocent. 72 00:08:48,390 --> 00:08:51,370 I want to print the text in the cell. 73 00:08:51,480 --> 00:09:00,500 I can use this shift and enter buttons to execute the code in the cell next in the notebook document 74 00:09:01,660 --> 00:09:08,310 each of the codes has a line number assigned to it next. 75 00:09:08,500 --> 00:09:18,370 Apart from typing your code in a code cell you can also add descriptions or text in a code set by changing 76 00:09:18,370 --> 00:09:29,820 the type of the cell to mark down say for example if you want to add a title to the code that you're 77 00:09:29,820 --> 00:09:41,790 going to enter you can use the single hash tag like this and then give a space and then enter your text. 78 00:09:41,790 --> 00:09:49,440 Say I'm going to add the text title and then hit shift and enter. 79 00:09:49,800 --> 00:09:51,460 So here's your title. 80 00:09:51,480 --> 00:09:58,470 Say for example you want to add major headings in your notebook document. 81 00:09:58,470 --> 00:10:06,910 You can use double hash tags and for that you first need to change the decode code type to mark down 82 00:10:07,480 --> 00:10:20,990 and then use double hash tags and enter your text lunacy major headings and then execute this. 83 00:10:20,990 --> 00:10:30,680 So you have your major headings beginning with two hash tags and if you want to have some subheadings 84 00:10:30,680 --> 00:10:40,430 in your notebook document you can use three hash tags like this and then have your text your subheading 85 00:10:40,820 --> 00:10:48,550 change your code typed or marked down and execute. 86 00:10:48,570 --> 00:10:54,690 So this is how you can enter descriptive text into your notebook document. 87 00:10:55,650 --> 00:10:59,100 Then you execute the code in a cell. 88 00:10:59,100 --> 00:11:09,500 The code is executed within a cone and any output is returned back to the Senate which is to be displayed. 89 00:11:09,840 --> 00:11:13,590 So every notebook runs a kernel. 90 00:11:13,610 --> 00:11:23,820 Next the Jupiter notebook gives us several options to export our notebook say for example you can go 91 00:11:23,820 --> 00:11:37,430 to the file menu here choose download as and weaken can board our Jupiter dot IP y and b notebook file 92 00:11:37,670 --> 00:11:48,610 in two and not this static format including each daemon latex PDA of Mark down and so on. 93 00:11:48,620 --> 00:11:57,350 Another function of the Jupiter notebook is the ability to create checkpoints by creating a checkpoint. 94 00:11:57,500 --> 00:12:06,050 We are storing the current state of the notebook so that we can later on go back to this check point 95 00:12:06,260 --> 00:12:10,580 and reward the changes which have been made to the notebook. 96 00:12:10,580 --> 00:12:21,580 In the meantime so in order to create a checkpoint go to file and then and choose safe and checkpoint. 97 00:12:21,800 --> 00:12:27,680 So here we have a text display last checkpoint. 98 00:12:27,680 --> 00:12:38,060 A few seconds ago for this notebook document and if you want to shut down the Jupiter notebook app closing 99 00:12:38,060 --> 00:12:44,810 the browser will not close the Jupiter notebook app in order to completely shut it down. 100 00:12:44,870 --> 00:12:56,820 You can go to Y and then choose clothes and hide or alternately you can go to the notebook dashboard 101 00:12:57,480 --> 00:13:06,780 in the notebook dashboard go to the tab running and here you have the list of notebook documents that 102 00:13:06,780 --> 00:13:14,670 are running so we have the Jupiter notebook class dot IP y N.B. file that we were working on and if 103 00:13:14,670 --> 00:13:22,080 you want to close the corner associated with this notebook you can click on shut down button as you 104 00:13:22,080 --> 00:13:34,230 can see here for example if you want to interrupt a code that is taking too long you can use the Kernan 105 00:13:35,300 --> 00:13:42,230 and click on the interrupt option in order to shut down a cone.