[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,1\N00:00:04,490 --> 00:00:09,040\NIn this video, I'm going to show you how to start up the Jupyter environment that we're going Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,2\N00:00:09,040 --> 00:00:13,550\Nto be using for our Python program and write some of our first Python code. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,3\N00:00:13,550 --> 00:00:18,110\NAlso walk through the steps needed to turn a notebook into a PDF Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,4\N00:00:18,110 --> 00:00:23,930\Nyou can submit on blackboard for one of the assignments. So I've already installed Anaconda. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,5\N00:00:23,930 --> 00:00:32,500\NYou can find the instructions for that on the course Web site. On Windows, when we've installed in ancondo, we get Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,6\N00:00:32,500 --> 00:00:40,630\Na new kind of prompt available in the START menu. So I can go in to start the anaconda power shall prompt. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,7\N00:00:40,630 --> 00:00:44,010\NAnd this starts up a power shell command line Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,8\N00:00:44,010 --> 00:00:51,790\Nthat has Anaconda activated. The process for doing this on Linux or on Windows is slightly different, although excuse me, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,9\N00:00:51,790 --> 00:01:00,160\Non Linux or on Mac is slightly different, although you can also start the prompt from the Anaconda navigator. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,10\N00:01:00,160 --> 00:01:09,490\NI will show you in another video how to activate Anaconda when we have it installed on Onyx, which will also apply to other Linux systems. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,11\N00:01:09,490 --> 00:01:18,610\NSo I'm in my anaconda prompt, it's in my home directory. I'm going to go to the directory I've created for working on C.S. 533. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,12\N00:01:18,610 --> 00:01:27,610\NSo I'm going to cd into documents\CS 533 assignments, and here I'm going to start the Jupyter environment with Jupyter notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,13\N00:01:27,610 --> 00:01:33,880\NSo we're gonna be doing our work in what we call notebooks. They're a part of Jupyter. We can start this at the command line with Jupyter notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,14\N00:01:33,880 --> 00:01:39,070\NAnd it's going to start up the Jupyter system and open it up in our Web browser. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,15\N00:01:39,070 --> 00:01:45,100\NThe Web browser is the interface that we use to interface with Jupyter and interact with notebooks. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,16\N00:01:45,100 --> 00:01:50,650\NSo if I had some notebook files in here, they would be listed in the notebook list and we could open them. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,17\N00:01:50,650 --> 00:01:55,900\NSo in the assignment, you'll download the starter notebook. Save it in the directory you're working in. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,18\N00:01:55,900 --> 00:02:00,860\NWhen you run Jupiter notebook, it will appear. But right now, I'm one to create a new notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,19\N00:02:00,860 --> 00:02:08,560\NI'm going to create a new Python 3 notebook because Python 3 is what we're using in this class. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,20\N00:02:08,560 --> 00:02:20,640\NAnd it's a new notebook and it's untitled. So I'm going to given a name here. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,21\N00:02:20,640 --> 00:02:24,640\NI'm just going to call it demo notebook because it's the notebook that I'm using to demonstrate. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,22\N00:02:24,640 --> 00:02:32,650\NIf I go back to our notebook list, we now see it and its "Demo Notebook.ipynb" the ipynb file as the source filed for the notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,23\N00:02:32,650 --> 00:02:39,130\NYou're going to be submitting those as one of the things you submit in your assignment. So now a notebook is made up of cells. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,24\N00:02:39,130 --> 00:02:46,110\NAnd right now we have one cell here. So I want to put some code in it. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,25\N00:02:46,110 --> 00:02:52,530\NI'm just going to write the string "Hello, world". The string isn't close in case, and it's enclosed in double quotes. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,26\N00:02:52,530 --> 00:03:01,480\NAnd I am going to hit shift enter. And that run - shift enter - runs the cell that we're currently in. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,27\N00:03:01,480 --> 00:03:09,970\NAnd now it's labeled In [1] . It's the first cell that we ran. And it has an output Out [1] that says, "Hello, world" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,28\N00:03:09,970 --> 00:03:19,960\NWhen you run a cell and the last line of the cell is an expression that has some value, what Jupyter will do is it will show you that value. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,29\N00:03:19,960 --> 00:03:24,700\NSo because the last and only line of the cell is the string value Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,30\N00:03:24,700 --> 00:03:28,540\N"Hello, world" It shows me the value. "Hello, world" Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,31\N00:03:28,540 --> 00:03:37,500\NIf I put in a value - a number - five, it will show me the number five. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,32\N00:03:37,500 --> 00:03:41,820\NIt only prints the value of the last line, but it lets us very quickly just see an object. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,33\N00:03:41,820 --> 00:03:48,990\NWe don't even need to worry about print statements. If we do want to create output, we can Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,34\N00:03:48,990 --> 00:03:53,310\Ncall print, and it will print the output for the way Python would usually print it. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,35\N00:03:53,310 --> 00:03:59,370\NIt shows up as a as as text. Jupyter is going to show the output of our program here. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,36\N00:03:59,370 --> 00:04:05,640\NIt's formatted a little differently because its output. It's not just showing the results of an expression. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,37\N00:04:05,640 --> 00:04:10,170\NThese code cells are not the only cells that we can have in a notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,38\N00:04:10,170 --> 00:04:16,530\NSo I'm going to insert a new cell above the above this one. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,39\N00:04:16,530 --> 00:04:21,030\NAnd I am going to change its type to markdown. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,40\N00:04:21,030 --> 00:04:34,090\NAnd in a markdown cell, we don't write python code, but we write text. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,41\N00:04:34,090 --> 00:04:39,790\NSo I wrote the text, this is the demonstration node to show notebook to show you how to run Python code. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,42\N00:04:39,790 --> 00:04:44,170\NAnd if I run this notebook, it just renders it as text. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,43\N00:04:44,170 --> 00:04:48,430\NNow I can edit it. I'm going to double click to edit it again. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,44\N00:04:48,430 --> 00:04:54,930\NThis supports all markdown features so we can give this notebook a heading. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,45\N00:04:54,930 --> 00:05:01,560\NWe always want to begin our notebook with a level one heading, which is done with a single hash that gives the title of the notebooks, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,46\N00:05:01,560 --> 00:05:07,030\Nthat then when we convert it to another format, we're gonna have the title right there. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,47\N00:05:07,030 --> 00:05:17,540\NMarkdown cells support a variety of formatting features. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,48\N00:05:17,540 --> 00:05:25,040\NSuch as bold and italics. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,49\N00:05:25,040 --> 00:05:37,060\NAlso, bulleted lists. Lists and numbered Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,50\N00:05:37,060 --> 00:05:47,080\Nlists. I'm going to stick another cell in here. I use the menu - Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,51\N00:05:47,080 --> 00:05:52,930\NI can also hit the A key and it will add a new cell above and M changes it to mark down. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,52\N00:05:52,930 --> 00:05:57,130\NThere's keys that will that will let us navigate the notebook quickly. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,53\N00:05:57,130 --> 00:06:00,070\NAlso, the notebook is what we call modal. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,54\N00:06:00,070 --> 00:06:08,860\NIf the if - the interface has two modes, if the cell is surrounded in green, I'm editing the contents of this cell. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,55\N00:06:08,860 --> 00:06:22,300\NWe can also show mathematical expressions like y = mx+b, you put them in dollar signs and they're going to be rendered. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,56\N00:06:22,300 --> 00:06:30,960\NI'm going to shift enter again. And now the math is showing up like math. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,57\N00:06:30,960 --> 00:06:37,410\NWhen it's blue, when the cell is highlighted in blue, we're not editing the contents of the cell, but rather we are moving around cells. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,58\N00:06:37,410 --> 00:06:43,560\NSo the up and down arrows, keys like a will add a cell instead of typing a in the cell. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,59\N00:06:43,560 --> 00:06:51,690\NOnce we're on a cell, we can hit enter to edit the cell and escape to change back to the mode where we navigate cells. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,60\N00:06:51,690 --> 00:06:59,940\NSo now we have this notebook control as saves the notebook. Jupiter has its own set of menus so we can do a variety of things like again, save Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,61\N00:06:59,940 --> 00:07:04,920\Nsave the notebook with a new name. We can make a copy of The Notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,62\N00:07:04,920 --> 00:07:09,510\NWe can also we're going to go submit the notebook - in order to give you feedback - Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,63\N00:07:09,510 --> 00:07:18,000\NI want a PDF of your notebook so that I can use blackboards, PDF markup tools to give you feedback on your assignments. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,64\N00:07:18,000 --> 00:07:27,810\NSo, Jupyter has the direct ability to create a PDF, but unfortunately requires an entire LaTeX installation. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,65\N00:07:27,810 --> 00:07:32,160\NAn additional software on top of that in order to go from a notebook to a PDF. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,66\N00:07:32,160 --> 00:07:36,450\NSo what instead we're going to do is we're going to go into the notebooks print preview. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,67\N00:07:36,450 --> 00:07:40,560\NSo I clicked file on the notebook interface. I go to print preview. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,68\N00:07:40,560 --> 00:07:44,340\NThis shows a trimmed down version of The Notebook that's not interactive. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,69\N00:07:44,340 --> 00:07:51,200\NIt doesn't have any in the interface. And now we can print this version of the notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,70\N00:07:51,200 --> 00:07:56,820\NAnd we can print your browser is going to let you save as a PDF when you go to print. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,71\N00:07:56,820 --> 00:08:06,320\NSo we're just going to use that save as PDF. I'm going to go put it in my assignment's directory. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,72\N00:08:06,320 --> 00:08:10,660\NDemo Notebook.pdf . I'm gonna dlose this window. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,73\N00:08:10,660 --> 00:08:14,050\NNow, if I go to that directory, I'm going to see both my ipynm file. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,74\N00:08:14,050 --> 00:08:18,850\NThat's the actual notebook file itself and the PDF file I just exported. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,75\N00:08:18,850 --> 00:08:23,650\NI can look at the contents of that PDF file and it looks like we expected. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,76\N00:08:23,650 --> 00:08:29,200\NWe see the notebook title at the top where he wrote that level one heading. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,77\N00:08:29,200 --> 00:08:33,370\NWe see all of our output. When you're submitting an assignment Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,78\N00:08:33,370 --> 00:08:39,610\Nwhat I want you to submit is both the ipynb file and the notebook file. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,79\N00:08:39,610 --> 00:08:47,830\NSo now. So when we're done with a notebook, then we go what it this file menu and we close and halt. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,80\N00:08:47,830 --> 00:08:56,500\NAnd this closes the notebook tab. But it also shuts down the python instance that's running in the background to let us run the code in the notebook. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,81\N00:08:56,500 --> 00:09:03,430\NIf you don't close a halt, you're going to wind up with a bunch of python instances kicking around that you may not want. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,82\N00:09:03,430 --> 00:09:10,120\NWe're gonna see more features of Jupyter as we go through the class, including things to manage the python processes that are running. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,83\N00:09:10,120 --> 00:09:14,410\NBut now you've seen the first steps to how you can open Jupyter. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,84\N00:09:14,410 --> 00:09:22,090\NYou can create a notebook. You've seen notebook cells and you've seen how we can take this notebook and create output Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,85\N00:09:22,090 --> 00:09:30,600\Nyou're going to submit when you submit the results of an assignment. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,