Good, we were able to create a line
graph using this code. And I hope you
played around with this code a little bit,
and got familiar with it. Now, you
see here that we got two lists as
output. In this lecture, I'll teach
you how to use CSV files to feed your
Bokeh graphs. And I'll use this code as
a reference. So I'm just going to, you
know, you need to press Escape. And when
you press Escape, you can apply
shortcuts, Keyboard Shortcuts to your
cells. And you can see a list of
shortcuts, in here, Keyboard Shotcuts.
And for instance, what I want to do now
is, I want to copy a cell with C and
then I want to paste it this, I want to paste that
cell below, with V. But first of all,
you need to be in Command Mode. So to go
into Command Mode, you need to press
Escape as the help script says. And
yeah, make sure Escape and then C, and
then V, and you get another cell in
here. Also, I'd like to actually remove
for this header here, go to View, Toggle
Header, Toggle Toolbars, so that I have
more space for you here. So this is the
code I'll be working with, Enter and
yep, I'll be working in this code for now.
And let me go here, this is working
directory. I'll just go ahead and create
a CSV file. Let's say data.csv
Yes, and I'm just going to edit it with
Notepad. So you can use Excel if you like.
[No audio]
So I just have two columns here,
this, that is the header, and then 1
for x, 6 for y, 2 and 7, and
3 and 8, and 4 and 9,
and one more 10. Save that. Close it. So note
that data.csv is in a same directory
with Basic graph.ipynb and go to
your script. Now, we are importing
Bokeh here, but I'll be importing
pandas as well. So let's makes sure these are there
and pandas. Let me use a lowercase b.
import pandas. Yep, prepare some data.
[No audio]
So as you know pandas. So basically,
the dataframe is the main object, and
you want to create a dataframe from a CSV file.
Now which is data.csv, just
like that, and that. Now let's create two
variables here. So the x variable will be equal to df
[No audio]
square brackets, the x column.
[No audio]
So don't confuse the x column with the x variable,
and they just happen to have the same name.
Okay. And also the y array, df
y, okay. I know, that should do it.
Let me rename this from_csv.
Execute. And you get exactly
the same line as we did earlier with
plain array lists in here. And yeah, that's
basically how you feed your Bokeh
plots with pandas dataframe arrays. So
again, just for the sake of clarifying
things, this is the dataframe, and it
has two columns. And you have the x
column there. So that was stored.
Actually, this is the index column, this
one here. This is the actual data of
that column and you also have the y column there.
[No audio]
So that's it. As you see a
Bokeh is able to read plain lists, so
Python list as this one here,
actually, and also Panda dataframe
array series. So this is called a
series. You can check that yeah, a series.
And here that's it. DD to delete a cell. And
yeah, we'll move on with some more
lectures there. See you.
[No audio]