1
00:00:00,770 --> 00:00:05,080
Good, we were able to create a line graph using this code.

2
00:00:05,130 --> 00:00:10,330
And I hope you played around with this code a little bit and got familiar with it.

3
00:00:10,540 --> 00:00:18,860
Now you see here that we got two lists as output. In this lecture I'll teach you how to use csv

4
00:00:18,890 --> 00:00:25,530
files to feed your Bokeh graphs and I'll use this code as a reference so I'm just going to you know

5
00:00:26,490 --> 00:00:35,470
you need to press escape when you press escape you can apply shortcuts keyboard shortcuts to your cells.

6
00:00:35,550 --> 00:00:42,030
You can see a list of shortcuts in here people, keyboard shortcuts. For instance what I want to do now is

7
00:00:42,430 --> 00:00:45,610
I want to copy a cell with C and then I want to paste it with V.

8
00:00:45,750 --> 00:00:48,630
I want to paste that cell below with V.

9
00:00:48,650 --> 00:00:56,160
But first of all you need to be in command mode so to go into common mode you need to press escape as

10
00:00:56,160 --> 00:01:04,090
the help script says and you make sure escape and then C and then V. And you get another cell

11
00:01:04,120 --> 00:01:05,200
in here.

12
00:01:05,240 --> 00:01:15,370
Also I'd like to actually remove this header here. Go to view, toggle header and toggle toolbar as well so that

13
00:01:15,390 --> 00:01:17,510
I have more space for you here.

14
00:01:17,700 --> 00:01:19,070
So this is the code

15
00:01:19,100 --> 00:01:28,050
I'll be working with, enter and I'll be working this code for now and let me go here.

16
00:01:28,080 --> 00:01:30,710
This is the working directory.

17
00:01:31,350 --> 00:01:38,370
I'll just go ahead and create a csv file, let's say data dot dot csv.

18
00:01:39,150 --> 00:01:40,140
Yes.

19
00:01:40,640 --> 00:01:47,580
I'm just going to edit it with Notepad. You can use Excel if you like.

20
00:01:48,960 --> 00:01:52,170
So I'll just have two columns here, this,

21
00:01:52,320 --> 00:02:05,400
that is the header and then 1 for x 6 for y, 2 and 7, and 3 and 8, and 4 and 9.

22
00:02:05,820 --> 00:02:07,840
One more, 10.

23
00:02:08,520 --> 00:02:11,390
Save that. Close it.

24
00:02:11,490 --> 00:02:21,760
So note that data.csv is in the same directory with Basic graph.ipynb. And go to your script.

25
00:02:21,960 --> 00:02:25,740
Now we are importing Bokeh here but I'll be importing Pandas as well.

26
00:02:25,830 --> 00:02:29,210
So let's mention this here and Pandas.

27
00:02:29,790 --> 00:02:33,420
Let me use a lowercase b.

28
00:02:34,460 --> 00:02:38,060
Import pandas, yeah, prepare some data.

29
00:02:40,810 --> 00:02:45,530
So, I assume you know Pandas.

30
00:02:46,020 --> 00:02:55,770
So basically the data frame is the main object and you want to create a data frame from the csv file which

31
00:02:55,770 --> 00:03:00,580
is data.csv just like that.

32
00:03:00,580 --> 00:03:03,940
And let's create two variables here.

33
00:03:04,170 --> 00:03:14,260
So the X variable will be equal to the df square brackets the X column.

34
00:03:15,600 --> 00:03:18,880
So don't confuse the X column with the x variable.

35
00:03:18,880 --> 00:03:21,460
And they just happen to have the same name.

36
00:03:21,870 --> 00:03:22,700
OK.

37
00:03:23,130 --> 00:03:29,420
And also the Y array the df  y.

38
00:03:29,670 --> 00:03:34,260
And yeah, that should do it.

39
00:03:34,670 --> 00:03:48,240
Let me rename this. From csv, execute and you get exactly the same line as we did earlier with the

40
00:03:49,030 --> 00:03:51,300
plain list in here.

41
00:03:51,520 --> 00:03:58,540
And that's basically how you feed your Bokeh plots with Pandas data frame arrays.

42
00:03:58,560 --> 00:04:04,250
So again just for the sake of clarifying things.

43
00:04:04,440 --> 00:04:05,940
This is the data frame.

44
00:04:06,000 --> 00:04:13,400
It has two columns and you have the X column then so that was stored.

45
00:04:13,410 --> 00:04:15,060
Actually this is the index column.

46
00:04:15,100 --> 00:04:16,070
This one here.

47
00:04:16,140 --> 00:04:18,610
This is the actual data of that column.

48
00:04:18,810 --> 00:04:21,600
And you also have the y column there.

49
00:04:22,740 --> 00:04:25,110
So that's it.

50
00:04:25,230 --> 00:04:29,090
So as you see Bokeh is able to read plain lists.

51
00:04:29,100 --> 00:04:32,000
So Python lists as this one here actually.

52
00:04:32,010 --> 00:04:35,670
And also data frame arrays, series.

53
00:04:35,730 --> 00:04:40,120
So this is called a series.

54
00:04:40,170 --> 00:04:43,570
You can check that, yeah a series.

55
00:04:43,820 --> 00:04:47,490
And yeah, that's it, dd to delete a cell.

56
00:04:47,760 --> 00:04:50,730
And we'll move on with some more lectures there.

57
00:04:50,850 --> 00:04:51,120
See you!

