Halaal, before going deep dive into the session, let's have a quick recap of what we all have until
now in this session.
So we have to import our data and doing lots of preprocessing, doing lots of analysis on our data.
And we have come up with some various insights using some beautiful visas.
And in the last sessions, we have somehow automate our analysis by writing these blocks of code in
a function.
And this is exactly my heat map that what we have done in all our previous session.
So in this session, we have this assignment in which we have some problem with statement.
So the very first is we have to perform analysis of location data points.
So if let's say I'm going to check how exactly my data looks like or data frame looks like.
So just call head over there and you will visualize overhead.
Here you have two features.
The very first is exactly the latitude and the second one is exactly your longitude.
So considering both the features, you have to come up with some insight.
So far, this is what I'm going to do over here.
I'm just going to say BLT dot plot.
And here I have to mention this, both the latitude and longitude.
So the very first one, I'm going to say deserve all longitude.
And the second feature.
Exactly my D of latitude.
And if you will pass shifts plus tab over here, you will get all the documentation, all the custom
parameters over here, let's say if I'm going to execute it.
So it will exactly return me this beautiful resource over here.
But before executing it, you have to mention your color offered it up.
Let's say I'm going to say are clouds so you can just go ahead with its documentation and you can check
all the custom parameters over here.
And these are basically ruffles here.
I just want my data points in red color.
That's it.
And if I'm going to execute it, it will take some couple of seconds and it will exactly written some
kind of beautiful result over here.
So this will exactly determine this, some kind of complex.
So let's say I have to modify over here.
I'm going to assign my MSH.
So here I'm going to say zero point five and let's say I have to assign my some X limit as well as some
limit.
Let's say I'm going to say my X limit is nothing, but let's say minus seventy four point two.
You will see here all almost here, almost here, which is exactly my minus seventy four point two.
So here I'm going to say minus seventy four point two and let's say from minus seventy four point two
degrees, my nose seventy three point seven, which will exactly will be somewhere close to here.
And after that, I'm also going to set my, let's say, y limit and y limit is nothing, but let's say
starting from forty point five, or you can also see 40 points.
It's on appeal.
And the second one is exactly forty one.
And let's say I have to customize this as well.
So I'm going to say BLT dot figure.
Just assign your own custom type, just press tab over here and you will get a parameter which is exactly
this size.
Let's say I just want our window side of to comma six and if you are going to execute it, it will take
some couple of seconds.
But this time you will definitely get some beautiful results from your previous.
And now you will see here from this visual, you can easily come up with this insight.
Yeah, add this reason.
At this reason we are we have a darker density.
It means at this particular reason we have some kind of higher rush.
It means that the reason we have some kind of maximum.
Right, let's say, is do I have to improve my analysis?
So in some scenarios, you can go ahead with your spatial analysis.
And this is exactly our next problem statement in which I have to perform this special analysis using
heat map to get a clear cut of what exactly is a rush in New York or whatever latitude and longitude
over here we have.
But let's say if you have to conclude from this visual, then you will see this is exactly almost midtown
Manhattan.
So you can clearly see this.
Midtown Manhattan is clearly a huge bright spot.
And these are basically from my midtown to lower Manhattan, followed by basically upper Manhattan and
heights of Brooklyn.
Let's say I need this clear cut of what exactly the rush is for this.
We can definitely go ahead with our spatial analysis.
So let's say I have to pull.
From this analysis on some particular day, let's say on weekend, so that if I have to add some filter
over here, I'm going to say, my dear of every day it calls to let's say for Sunday, let's say I just
need data of Sunday.
So I have to just pass this filter in my data frame.
Alexei, this final data frame name is nothing but like tedious on a score out, just executed.
And if I'm going to call a shape or whatever.
Now you'll see it had that much number of thought and it has that much number of columns.
And let's say if I'm going to call ahead over there now, you would visualize how exactly your data
from looks like now what you have to do, you have to group your data on the basis of this latitude
and longitude because you need what exactly is a rush on particular city, on particular latitude and
longitude.
It means you have to group your data on the basis of this latitude and longitude.
For this.
I'm just going to say, Dave, underscore out Dot Grassby, I have to call this group by and very first
I have to group my data on the basis of this latitude.
After that I have to go it again on the basis of longitude.
Once I have all this stuff I have to access this day and once I will access this every day, I have
to just call this count or there.
And if I'm going to execute it, I will see.
With respect to all this team, you have some account value assigned.
Now, let's say I have to convert this into my some data frames for this.
I have to just call this reset and index over here.
So it will.
Exactly returning my data frame.
I have to store it somewhere as let's say I'm going to say data frame name is nothing, but that's Arush
just executed.
And if I'm going to print it now, you will see with respect to this latitude and longitude, you have
that much brush.
It means with respect to this latitude and longitude, you have that much number of troops.
And if you want to modify your column, you can definitely come up with that.
I'm going to say the DOT columns and my column name is actually the very first one is latitude.
The second one is, let's say longitude, and the third one, let's say a number of trips.
So I'm going to say number of trips.
So just executed.
And if, again, I'm going to print that said.
So this is exactly the data frame that you have to consider to perform.
You're some kind of a spatial analysis depending upon what problem statement you have to perform your
spatial analysis.
You need some external modules, you need some heat map.
So for this, I'm going to say from this podium, and if you haven't installed your solium, you guys
can simply install using this PIP install SOLIUM, you can simply execute this one and it will install
your Foleo in your environment.
So from this FOLIA, what you have installed over here, you have to import your some module, which
is exactly my plugin.
So I'm going to say this plugins and I have to import something known as which is exactly my heat map,
so just execute it.
And now what I have to do, let's say I have to also import my so I'm going to say import your folia
after importing or forelimb.
Let's say I need some base map so that I can showcase my visual on top of that.
So for days what I'm going to do, I'm just going to use this for longer.
This I'm going to say for forelimb dot map here.
It has some inbuilt function and if I'm going to execute it, it will return with some beautiful, inbuilt
world map over here.
And this is exactly that.
You can zoom in, zoom out and various functionalities assigned to this map.
Let's say I'm going to say it is nothing.
It is just my base map just executed now.
And now is the time to perform your spatial analysis using this heat map.
So here I'm just going to say you have to use this heat map.
So what exactly is the heat map?
So wherever my count will be, higher heat map will reflect that has a higher density.
That's it.
That's all about my core idea behind heat map for this.
What I'm going to do in this Rust column, I have something.
So in this heat, my function, you have to just pass your data frame.
That's it.
And here you have some custom parameter, the very first one.
What exactly is the frame?
Then you have all this custom parameter that has some defined value, that has some predefined values
defined by my python developers that say I have to customize my legs.
I'm going to say my.
Parameter values, 20 mile radii, or you can see a radius, whatever you can name it is my radius is
nothing more, let's say 15 and whatever heat map it will return me, I have to simply add it to on
the top of my base map.
So for this, I have a function which is exactly adding a score to and here I have to mention my base
map.
Once I have all this stuff, then Simples and I have to print my basement.
That's it.
So just execute the SAT and it will take a while to showcase your beautiful heat map.
You will see over here.
This is exactly a beautiful heat map.
And if you are going to zoom in this now, you can easily visualize it here easily.
You can easily see this is exactly what Washington.
Let me zoom in again.
And this is exactly where all these cities over here.
Let me zoom in again and you can easily showcase all these conclusions from this we saw.
And now you can definitely come up with some meaningful insight from this spatial analysis.
Whereas if you are going to compare this, you can compare this heat map from the other one.
You can definitely come up with some meaningful insights from this spatial rather than the previous
disadvantage of using your patient analysis, using your heat map concept.
And from this analysis, we can definitely come up with this insight.
Yeah, this is The Zone, which is exactly my midtown Manhattan.
And this is exactly a huge bright is what it means in this in this almost in the zone.
We have a maximum number of rights in this zone.
So whenever a user is going to Boca Gabb from this particular zone so we can offer some discount to
increase my sales.
So that's the type of the season we can with that.
So that's the type of analysis how you can go ahead with the problem statement.
So let's go ahead with our next statement in which I have to automate all this stuff.
Whatever I have done over here, I have to just create a function in which I have.
Right all these blocks of code for this.
What I'm going to do, I'm just going to define a function that's a function name is DOT and whatever
parameter it will receive me, I'm going to define it later.
So what exactly was my very first task in the very first task I have as a data frame, depending upon
my condition, depending upon the day on which I had to do this analysis.
Let's say at this time I have to do analysis for some particular date.
So here I'm going to say my weekday equally, because today it means this disvalue.
Basically you are going to receive from functions here.
The very first parameter is your function, let's say the very first one is data from the second one
is the day that these are exactly both parameters.
After what I have done, I have basically called this group by Auteur's here.
I am going to say I have to just call this or you can just copy this from here and you have to just
paste over here.
That's it.
Now, here you have to mention either you can store it in some data frame or you can directly pass this
in some.
Lexing will directly say, I have to just pass this stuff in my heat map.
And your parameter.
What was mine here?
I have something which is my zoom parameter and I have something which is exactly my, let's say, radius
parameter.
My radius was, I think 50 and whatever heat map it will return me, I have to just add it to my best
maps for this.
I'm going to say add in this score to and here I have to see what exactly is my piece map.
So very first you have to define your base map as well.
So here I am going to say my base is nothing but this forelimb dot map and let's say I'm going to store
it.
So here my base map is this one.
Yeah.
And what's happening?
All this stuff is what I have to do.
I have to return this base map, whatever base map I have over here.
So I have to simply return it.
So now I have to just execute the sale and now I have to simply call this function here.
I'm going to say I have to call this function what exactly my data from, which is exactly my idea.
And let's say I just need my own analysis for that Saturday.
So here I have to just past Saturday.
And if you are going to execute it, you will get this type of amazing result from your huge chunk of
data next year.
I have to just zoom in this.
Let me again zoom in it.
Let me again zoom in it and you will observe.
You can clearly observe is still your Mad Hatter is still your huge bright spot for your Saturday as
well.
But it's still there is some modification you will observe from my.
One and in this one, yeah, you can definitely see this difference, so I hope you will love this session
very much and how I have to meet all the analysts, how exactly I have performed is analysis on data.
I hope you will love it very much.
Thank you.
How nice to keep learning.
Keep growing.
Keep practicing.