>> Let's get in and take a look at a little bit of code here.
So just like before,
we're going to bring in our pandas library and we're
going to load in that exact same data.
So nothing new here.
But now what we want to do is we
want to start plotting everything out.
So we're going to bring in our Matplotlib,
and then we're going to plot directly from that DataFrame.
So what I want you to notice here
is the fact that we're setting up
a scatter chart or
a scatter plot rather that we're going to do x is the distance,
y as the arrival delay.
When we see this,
what we're going to notice is that,
give it a moment here,
that there is no correlation between
those values that we're seeing a true scatter plot.
We have got values scattered everywhere.
If we take a look though at something
that's definitely going to be tied together,
which is the departure delay and arrival delay,
now what we're going to see is a different result.
Again, give this just a second here,
and now we can see that little chart going across.
It's really the exact same code,
the only thing that we changed was just the xy columns here.
So there is everything.
Now I'd like to get that neat little red line there slapped down,
and I'm going to do that by using
a little bit of linear regression.
So let's bring in everything for our linear regression here,
and I'm not going to dig too deep into this code.
You can go check out the prior module
where we talked about linear regression.
The thing that I want you to notice is that we're
going through the exact same steps
that we're dropping the null values,
we're setting up our x.
So this is the feature.
This is what's going to drive the value as the departure delay.
We're going to set up
the arrival delay as the value we want to predict,
that's going to put that on a nice neat little line for us,
and then we're going to execute our regressor,
and then get the prediction values back.
So now, I've got all of that inside of the y predict.
So now let's build up that chart.
So right here, we've got our X_test.
Let me just type out here real quick,
that is going to be the departure delay,
and then right here that Y_predict,
this is now going to be that smoothed out arrival delay there.
That's going to be
that neat little line that
the linear regression model created for us.
So that's going to be our x and our y respectively.
So now, I can run that and there is
that neat little red line that we were just talking about.
Let's say I want to see that on top of the scatter plot data,
well, that's right here.
So what you're going to notice is one more time we're
plotting everything out just like we did before.
We're setting up our scatter plot just like we did before.
The main difference really is just the fact that we're
calling bulk plot and scatter here.
So now when we call show down at the very bottom,
it's going to put both onto one nice neat little graph,
and now we can see that red line going
across all of our scattered values.
So that's how we can use
our scatter plot to get
a real good sense of what's going on with our data.
So we can see whether or not there is correlation, and in turn,
we can even use linear regression just to
get a nice neat little line that we can
slap down to be able to better get
a sense for what's going on with our data.