>> Let's take a look at a notebook where we've got
a little bit of code that
highlights what it was that we talked about previously,
So what we're going to notice here is we're going to
start off by loading up our pandas
library just as we normally would in Python code because you
can obviously rewrite in Python by
simply saying import pandas as pd,
Now, I'm now actually going to leave
this behind for just a second here,
I actually want to do
things out of order and then I'm going to double back,
So what I'm actually going to do is,
I'm going to run this line of code right
here where I'm trying to use that pandas library,
and what you're going to notice of course is that,
it's going to give us an error message saying, "Hey,
I don't know what pd is,
Pd is not defined,"
The reason that it's not defined is because of course,
we didn't run that little line of code right up top,
so let's run that,
So I'll do a real quick shift enter
that will actually move me down,
You'll notice now I can see
the little number two right there that tells me that this is run,
and so now I can keep it on,
and create little basic series here,
So when I run this, what you're going to notice is my output
here is going to be my datatype,
It's telling me the datatype that's inside of there,
object or string really,
You'll notice my index over here are, 0, 1, 2,
3, 4, 5, and 6,
You're also going to notice
that cool little trick that we talked about previously,
where if I just put
a variable or some operation that's going to return
back a value at the end line inside of a cell,
that I'll just simply print that out,
Boom, we go ahead,
we have airports and that will just go
ahead and print that out right there,
That's something I find myself doing quite frequently
because especially when you're dealing with
data that you've loaded in from somewhere else,
maybe you've done it a couple of manipulations on it,
now you'll want to see what the updated values are,
You want to see maybe whether or not you did things
correctly, Those types of things,
It's a very quick and easy way that you can do that,
and it will just simply print
out if I want to go in and access a particular item,
then I can do that by its index,
So I'll go grab two,
That's of course can be the third item,
all counting starts with the zero,
So that's going to give me back a London Heathrow,
and then you'll also notice
that I could loop through all of the items,
do a real quick print,
and then you're going to notice that it gives me
all of the values back,
I do want to do a real quick aside here,
I want to point out one subtle little thing
that I'll sometimes get asked when I'm doing notebooks here,
Now you'll notice that up to the very topic London Heathrow,
that I've got the single quotes
there indicating the fact that it's a string,
and then you'll notice down below that I don't get that,
that I just simply get the string without the single quotes,
You might be wondering, well,
why the difference there?
What's happening?
What's happening there is effectively
what's in charge of displaying something out on the screen,
When you use print,
print is going to write something out to the console,
and print has its own way of writing things out to the console,
In this case, my notebook is playing the role of the console,
So we're seeing really the exact same output
that we would see if we were running this locally,
So no single quotes or anything like that,
it's just simply writing out to the console
that's the expected behavior and we're done,
So it's not my notebook that's printing it out,
but rather really it's print that's in
control of how that's going to be printed out,
On the flip side however,
if I just simply do this,
where I'm executing a little bit
of code, that's what I'm doing there,
I'm saying airports and then my indexer of two,
I'm executing a little bit of code,
That code is then going to return back a value to me,
In that case, it's now going to be
Jupiter that's in charge of printing that out,
and that's why we're getting a little string
there because it's indicating to me,
giving me a little bit of a hint there of the datatype as well,
So it's showing me, hey,
this is a string,
and that's why I'm seeing those single quotes there,
So to distill all of that down,
the difference between those two is print,
It's just in charge,
it's printing out all of those values as opposed to just
executing a little bit of code that's giving me
a value back when the notebook is in charge,
then it's the notebook that's going
to determine how that's going to be output,
The people who did up Jupiter and
put all of this together decided, hey,
we also want to indicate to you the datatype,
and that's why you're getting the single-quotes there,
So if you are curious, that's what's going on,
Back to our regularly scheduled programming here,
let's take a look at a DataFrame,
So now what we're going to do is execute
the exact same bit of code that we saw on the slide,
What you're going to notice is that,
we've got our list of lists,
So we've got right here,
Seattle-Tacoma, Seattle in the USA, as a list,
Each one of those entries is now going to become
a cell inside of a row,
So when I run this, you're going to notice down below
that now, there we go,
That is now a row as promised,
and then you'll also notice
that each of the first entries then becomes a column,
and then you'll notice my column names are there rather unhelpful,
0, 1, and 2,
If we have the opportunity to name something,
we should almost always take that opportunity,
So thus what we're going to do right
here is we're going to indicate,
hey, let's put in some columns here,
So let's identify,
The first one is name,
the second one is city,
and then the third as country,
So now, let's go ahead and run that,
Now, you're going to notice the output there with our name,
our city, and our country,
Okay, As highlighted towards the end of the last little video,
there where we are introducing all of this,
there's an awful lot that we can do with DataFrames,
This is how we can go in and create them,
In the next section,
we're going to take a look at how we can start to
manipulate them a little bit and start
to see what's going on inside of them,