1 00:00:00,220 --> 00:00:07,610 Halaal, before going deep dive into the session, let's have a quick recap of what we all have until 2 00:00:07,650 --> 00:00:08,700 now in this session. 3 00:00:08,970 --> 00:00:15,210 So we have to import our data and doing lots of preprocessing, doing lots of analysis on our data. 4 00:00:15,450 --> 00:00:20,520 And we have come up with some various insights using some beautiful visas. 5 00:00:20,790 --> 00:00:27,120 And in the last sessions, we have somehow automate our analysis by writing these blocks of code in 6 00:00:27,120 --> 00:00:27,800 a function. 7 00:00:27,810 --> 00:00:33,530 And this is exactly my heat map that what we have done in all our previous session. 8 00:00:33,840 --> 00:00:39,050 So in this session, we have this assignment in which we have some problem with statement. 9 00:00:39,060 --> 00:00:44,360 So the very first is we have to perform analysis of location data points. 10 00:00:44,360 --> 00:00:50,390 So if let's say I'm going to check how exactly my data looks like or data frame looks like. 11 00:00:50,460 --> 00:00:53,800 So just call head over there and you will visualize overhead. 12 00:00:54,010 --> 00:00:56,130 Here you have two features. 13 00:00:56,250 --> 00:01:02,110 The very first is exactly the latitude and the second one is exactly your longitude. 14 00:01:02,280 --> 00:01:06,240 So considering both the features, you have to come up with some insight. 15 00:01:06,450 --> 00:01:08,960 So far, this is what I'm going to do over here. 16 00:01:08,970 --> 00:01:11,400 I'm just going to say BLT dot plot. 17 00:01:11,400 --> 00:01:16,250 And here I have to mention this, both the latitude and longitude. 18 00:01:16,260 --> 00:01:20,430 So the very first one, I'm going to say deserve all longitude. 19 00:01:20,670 --> 00:01:21,870 And the second feature. 20 00:01:21,870 --> 00:01:24,840 Exactly my D of latitude. 21 00:01:25,020 --> 00:01:31,170 And if you will pass shifts plus tab over here, you will get all the documentation, all the custom 22 00:01:31,170 --> 00:01:34,850 parameters over here, let's say if I'm going to execute it. 23 00:01:35,070 --> 00:01:39,410 So it will exactly return me this beautiful resource over here. 24 00:01:39,420 --> 00:01:43,590 But before executing it, you have to mention your color offered it up. 25 00:01:43,800 --> 00:01:51,450 Let's say I'm going to say are clouds so you can just go ahead with its documentation and you can check 26 00:01:51,450 --> 00:01:53,700 all the custom parameters over here. 27 00:01:53,880 --> 00:01:57,210 And these are basically ruffles here. 28 00:01:57,420 --> 00:02:01,170 I just want my data points in red color. 29 00:02:01,180 --> 00:02:01,740 That's it. 30 00:02:01,890 --> 00:02:08,070 And if I'm going to execute it, it will take some couple of seconds and it will exactly written some 31 00:02:08,070 --> 00:02:09,960 kind of beautiful result over here. 32 00:02:09,970 --> 00:02:13,350 So this will exactly determine this, some kind of complex. 33 00:02:13,460 --> 00:02:15,840 So let's say I have to modify over here. 34 00:02:15,840 --> 00:02:17,780 I'm going to assign my MSH. 35 00:02:18,030 --> 00:02:24,390 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 36 00:02:24,600 --> 00:02:24,990 limit. 37 00:02:25,260 --> 00:02:32,300 Let's say I'm going to say my X limit is nothing, but let's say minus seventy four point two. 38 00:02:32,310 --> 00:02:40,350 You will see here all almost here, almost here, which is exactly my minus seventy four point two. 39 00:02:40,360 --> 00:02:47,400 So here I'm going to say minus seventy four point two and let's say from minus seventy four point two 40 00:02:47,850 --> 00:02:55,410 degrees, my nose seventy three point seven, which will exactly will be somewhere close to here. 41 00:02:55,800 --> 00:03:02,700 And after that, I'm also going to set my, let's say, y limit and y limit is nothing, but let's say 42 00:03:03,060 --> 00:03:07,200 starting from forty point five, or you can also see 40 points. 43 00:03:07,470 --> 00:03:08,280 It's on appeal. 44 00:03:08,850 --> 00:03:12,240 And the second one is exactly forty one. 45 00:03:12,240 --> 00:03:15,110 And let's say I have to customize this as well. 46 00:03:15,450 --> 00:03:17,700 So I'm going to say BLT dot figure. 47 00:03:18,090 --> 00:03:24,690 Just assign your own custom type, just press tab over here and you will get a parameter which is exactly 48 00:03:24,720 --> 00:03:25,590 this size. 49 00:03:25,800 --> 00:03:33,930 Let's say I just want our window side of to comma six and if you are going to execute it, it will take 50 00:03:33,930 --> 00:03:35,070 some couple of seconds. 51 00:03:35,160 --> 00:03:40,440 But this time you will definitely get some beautiful results from your previous. 52 00:03:40,440 --> 00:03:46,080 And now you will see here from this visual, you can easily come up with this insight. 53 00:03:46,080 --> 00:03:48,180 Yeah, add this reason. 54 00:03:48,180 --> 00:03:51,060 At this reason we are we have a darker density. 55 00:03:51,060 --> 00:03:55,820 It means at this particular reason we have some kind of higher rush. 56 00:03:55,860 --> 00:03:59,340 It means that the reason we have some kind of maximum. 57 00:03:59,340 --> 00:04:02,970 Right, let's say, is do I have to improve my analysis? 58 00:04:03,210 --> 00:04:07,950 So in some scenarios, you can go ahead with your spatial analysis. 59 00:04:07,950 --> 00:04:15,270 And this is exactly our next problem statement in which I have to perform this special analysis using 60 00:04:15,270 --> 00:04:23,190 heat map to get a clear cut of what exactly is a rush in New York or whatever latitude and longitude 61 00:04:23,190 --> 00:04:24,240 over here we have. 62 00:04:24,240 --> 00:04:30,900 But let's say if you have to conclude from this visual, then you will see this is exactly almost midtown 63 00:04:30,900 --> 00:04:31,620 Manhattan. 64 00:04:31,620 --> 00:04:33,750 So you can clearly see this. 65 00:04:33,750 --> 00:04:38,070 Midtown Manhattan is clearly a huge bright spot. 66 00:04:38,070 --> 00:04:46,870 And these are basically from my midtown to lower Manhattan, followed by basically upper Manhattan and 67 00:04:47,280 --> 00:04:48,870 heights of Brooklyn. 68 00:04:49,140 --> 00:04:54,630 Let's say I need this clear cut of what exactly the rush is for this. 69 00:04:54,630 --> 00:04:57,960 We can definitely go ahead with our spatial analysis. 70 00:04:58,320 --> 00:04:59,770 So let's say I have to pull. 71 00:04:59,830 --> 00:05:05,920 From this analysis on some particular day, let's say on weekend, so that if I have to add some filter 72 00:05:05,920 --> 00:05:14,200 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 73 00:05:14,200 --> 00:05:16,180 need data of Sunday. 74 00:05:16,180 --> 00:05:19,360 So I have to just pass this filter in my data frame. 75 00:05:19,660 --> 00:05:25,750 Alexei, this final data frame name is nothing but like tedious on a score out, just executed. 76 00:05:25,750 --> 00:05:29,780 And if I'm going to call a shape or whatever. 77 00:05:30,470 --> 00:05:36,220 Now you'll see it had that much number of thought and it has that much number of columns. 78 00:05:36,370 --> 00:05:42,340 And let's say if I'm going to call ahead over there now, you would visualize how exactly your data 79 00:05:42,340 --> 00:05:49,210 from looks like now what you have to do, you have to group your data on the basis of this latitude 80 00:05:49,420 --> 00:05:57,520 and longitude because you need what exactly is a rush on particular city, on particular latitude and 81 00:05:57,520 --> 00:05:58,060 longitude. 82 00:05:58,060 --> 00:06:03,040 It means you have to group your data on the basis of this latitude and longitude. 83 00:06:03,280 --> 00:06:03,900 For this. 84 00:06:03,910 --> 00:06:10,180 I'm just going to say, Dave, underscore out Dot Grassby, I have to call this group by and very first 85 00:06:10,180 --> 00:06:13,310 I have to group my data on the basis of this latitude. 86 00:06:13,690 --> 00:06:18,070 After that I have to go it again on the basis of longitude. 87 00:06:18,070 --> 00:06:25,420 Once I have all this stuff I have to access this day and once I will access this every day, I have 88 00:06:25,420 --> 00:06:27,890 to just call this count or there. 89 00:06:28,120 --> 00:06:31,000 And if I'm going to execute it, I will see. 90 00:06:31,270 --> 00:06:35,340 With respect to all this team, you have some account value assigned. 91 00:06:35,650 --> 00:06:39,160 Now, let's say I have to convert this into my some data frames for this. 92 00:06:39,160 --> 00:06:42,510 I have to just call this reset and index over here. 93 00:06:42,940 --> 00:06:43,360 So it will. 94 00:06:43,360 --> 00:06:45,010 Exactly returning my data frame. 95 00:06:45,010 --> 00:06:51,070 I have to store it somewhere as let's say I'm going to say data frame name is nothing, but that's Arush 96 00:06:51,070 --> 00:06:52,210 just executed. 97 00:06:52,210 --> 00:06:58,360 And if I'm going to print it now, you will see with respect to this latitude and longitude, you have 98 00:06:58,360 --> 00:06:59,680 that much brush. 99 00:07:00,070 --> 00:07:06,760 It means with respect to this latitude and longitude, you have that much number of troops. 100 00:07:06,940 --> 00:07:11,470 And if you want to modify your column, you can definitely come up with that. 101 00:07:11,760 --> 00:07:17,200 I'm going to say the DOT columns and my column name is actually the very first one is latitude. 102 00:07:17,560 --> 00:07:23,440 The second one is, let's say longitude, and the third one, let's say a number of trips. 103 00:07:23,440 --> 00:07:25,720 So I'm going to say number of trips. 104 00:07:25,930 --> 00:07:27,070 So just executed. 105 00:07:27,070 --> 00:07:29,720 And if, again, I'm going to print that said. 106 00:07:29,740 --> 00:07:34,180 So this is exactly the data frame that you have to consider to perform. 107 00:07:34,180 --> 00:07:40,840 You're some kind of a spatial analysis depending upon what problem statement you have to perform your 108 00:07:40,990 --> 00:07:42,280 spatial analysis. 109 00:07:42,310 --> 00:07:46,530 You need some external modules, you need some heat map. 110 00:07:46,540 --> 00:07:54,220 So for this, I'm going to say from this podium, and if you haven't installed your solium, you guys 111 00:07:54,220 --> 00:08:03,580 can simply install using this PIP install SOLIUM, you can simply execute this one and it will install 112 00:08:03,580 --> 00:08:05,760 your Foleo in your environment. 113 00:08:06,010 --> 00:08:12,850 So from this FOLIA, what you have installed over here, you have to import your some module, which 114 00:08:12,850 --> 00:08:14,800 is exactly my plugin. 115 00:08:14,800 --> 00:08:21,220 So I'm going to say this plugins and I have to import something known as which is exactly my heat map, 116 00:08:21,520 --> 00:08:22,840 so just execute it. 117 00:08:22,840 --> 00:08:30,930 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 118 00:08:31,180 --> 00:08:32,950 after importing or forelimb. 119 00:08:33,160 --> 00:08:39,060 Let's say I need some base map so that I can showcase my visual on top of that. 120 00:08:39,310 --> 00:08:43,560 So for days what I'm going to do, I'm just going to use this for longer. 121 00:08:43,600 --> 00:08:47,740 This I'm going to say for forelimb dot map here. 122 00:08:47,740 --> 00:08:54,580 It has some inbuilt function and if I'm going to execute it, it will return with some beautiful, inbuilt 123 00:08:54,880 --> 00:08:56,350 world map over here. 124 00:08:56,350 --> 00:08:58,270 And this is exactly that. 125 00:08:58,480 --> 00:09:03,460 You can zoom in, zoom out and various functionalities assigned to this map. 126 00:09:03,640 --> 00:09:05,230 Let's say I'm going to say it is nothing. 127 00:09:05,230 --> 00:09:08,740 It is just my base map just executed now. 128 00:09:08,920 --> 00:09:14,710 And now is the time to perform your spatial analysis using this heat map. 129 00:09:14,980 --> 00:09:18,970 So here I'm just going to say you have to use this heat map. 130 00:09:18,970 --> 00:09:20,530 So what exactly is the heat map? 131 00:09:20,770 --> 00:09:28,000 So wherever my count will be, higher heat map will reflect that has a higher density. 132 00:09:28,300 --> 00:09:28,900 That's it. 133 00:09:28,900 --> 00:09:33,580 That's all about my core idea behind heat map for this. 134 00:09:33,580 --> 00:09:37,300 What I'm going to do in this Rust column, I have something. 135 00:09:37,300 --> 00:09:41,590 So in this heat, my function, you have to just pass your data frame. 136 00:09:41,590 --> 00:09:42,130 That's it. 137 00:09:42,310 --> 00:09:45,850 And here you have some custom parameter, the very first one. 138 00:09:45,850 --> 00:09:47,260 What exactly is the frame? 139 00:09:47,260 --> 00:09:53,650 Then you have all this custom parameter that has some defined value, that has some predefined values 140 00:09:53,650 --> 00:09:58,720 defined by my python developers that say I have to customize my legs. 141 00:09:58,750 --> 00:09:59,600 I'm going to say my. 142 00:09:59,900 --> 00:10:07,880 Parameter values, 20 mile radii, or you can see a radius, whatever you can name it is my radius is 143 00:10:07,880 --> 00:10:14,860 nothing more, let's say 15 and whatever heat map it will return me, I have to simply add it to on 144 00:10:14,900 --> 00:10:16,490 the top of my base map. 145 00:10:16,700 --> 00:10:22,700 So for this, I have a function which is exactly adding a score to and here I have to mention my base 146 00:10:22,730 --> 00:10:23,030 map. 147 00:10:23,450 --> 00:10:28,070 Once I have all this stuff, then Simples and I have to print my basement. 148 00:10:28,070 --> 00:10:28,650 That's it. 149 00:10:29,000 --> 00:10:34,870 So just execute the SAT and it will take a while to showcase your beautiful heat map. 150 00:10:35,250 --> 00:10:36,210 You will see over here. 151 00:10:36,250 --> 00:10:38,420 This is exactly a beautiful heat map. 152 00:10:38,420 --> 00:10:44,030 And if you are going to zoom in this now, you can easily visualize it here easily. 153 00:10:44,030 --> 00:10:46,790 You can easily see this is exactly what Washington. 154 00:10:46,980 --> 00:10:48,200 Let me zoom in again. 155 00:10:48,200 --> 00:10:49,370 Let me zoom in again. 156 00:10:49,370 --> 00:10:52,260 And this is exactly where all these cities over here. 157 00:10:52,550 --> 00:10:59,220 Let me zoom in again and you can easily showcase all these conclusions from this we saw. 158 00:10:59,240 --> 00:11:04,910 And now you can definitely come up with some meaningful insight from this spatial analysis. 159 00:11:05,090 --> 00:11:10,960 Whereas if you are going to compare this, you can compare this heat map from the other one. 160 00:11:11,150 --> 00:11:18,050 You can definitely come up with some meaningful insights from this spatial rather than the previous 161 00:11:18,440 --> 00:11:23,510 disadvantage of using your patient analysis, using your heat map concept. 162 00:11:23,510 --> 00:11:27,610 And from this analysis, we can definitely come up with this insight. 163 00:11:27,790 --> 00:11:32,450 Yeah, this is The Zone, which is exactly my midtown Manhattan. 164 00:11:32,450 --> 00:11:38,960 And this is exactly a huge bright is what it means in this in this almost in the zone. 165 00:11:39,170 --> 00:11:42,110 We have a maximum number of rights in this zone. 166 00:11:42,440 --> 00:11:49,970 So whenever a user is going to Boca Gabb from this particular zone so we can offer some discount to 167 00:11:49,970 --> 00:11:51,110 increase my sales. 168 00:11:51,230 --> 00:11:54,280 So that's the type of the season we can with that. 169 00:11:54,590 --> 00:11:58,750 So that's the type of analysis how you can go ahead with the problem statement. 170 00:11:59,030 --> 00:12:05,170 So let's go ahead with our next statement in which I have to automate all this stuff. 171 00:12:05,390 --> 00:12:11,070 Whatever I have done over here, I have to just create a function in which I have. 172 00:12:11,090 --> 00:12:14,100 Right all these blocks of code for this. 173 00:12:14,150 --> 00:12:20,150 What I'm going to do, I'm just going to define a function that's a function name is DOT and whatever 174 00:12:20,150 --> 00:12:23,120 parameter it will receive me, I'm going to define it later. 175 00:12:23,600 --> 00:12:30,410 So what exactly was my very first task in the very first task I have as a data frame, depending upon 176 00:12:30,410 --> 00:12:34,820 my condition, depending upon the day on which I had to do this analysis. 177 00:12:34,820 --> 00:12:38,490 Let's say at this time I have to do analysis for some particular date. 178 00:12:38,810 --> 00:12:44,870 So here I'm going to say my weekday equally, because today it means this disvalue. 179 00:12:45,170 --> 00:12:48,170 Basically you are going to receive from functions here. 180 00:12:48,170 --> 00:12:52,790 The very first parameter is your function, let's say the very first one is data from the second one 181 00:12:52,790 --> 00:12:56,150 is the day that these are exactly both parameters. 182 00:12:56,150 --> 00:13:00,950 After what I have done, I have basically called this group by Auteur's here. 183 00:13:00,950 --> 00:13:07,430 I am going to say I have to just call this or you can just copy this from here and you have to just 184 00:13:07,430 --> 00:13:08,290 paste over here. 185 00:13:08,300 --> 00:13:08,760 That's it. 186 00:13:09,350 --> 00:13:17,510 Now, here you have to mention either you can store it in some data frame or you can directly pass this 187 00:13:17,510 --> 00:13:17,960 in some. 188 00:13:18,410 --> 00:13:23,570 Lexing will directly say, I have to just pass this stuff in my heat map. 189 00:13:23,810 --> 00:13:25,430 And your parameter. 190 00:13:25,430 --> 00:13:27,350 What was mine here? 191 00:13:27,350 --> 00:13:33,890 I have something which is my zoom parameter and I have something which is exactly my, let's say, radius 192 00:13:33,890 --> 00:13:34,550 parameter. 193 00:13:34,550 --> 00:13:40,790 My radius was, I think 50 and whatever heat map it will return me, I have to just add it to my best 194 00:13:40,790 --> 00:13:41,600 maps for this. 195 00:13:41,600 --> 00:13:47,560 I'm going to say add in this score to and here I have to see what exactly is my piece map. 196 00:13:47,570 --> 00:13:50,060 So very first you have to define your base map as well. 197 00:13:50,360 --> 00:13:57,710 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 198 00:13:57,710 --> 00:13:57,880 it. 199 00:13:57,890 --> 00:14:00,360 So here my base map is this one. 200 00:14:00,390 --> 00:14:00,700 Yeah. 201 00:14:01,100 --> 00:14:02,140 And what's happening? 202 00:14:02,210 --> 00:14:03,950 All this stuff is what I have to do. 203 00:14:03,950 --> 00:14:09,250 I have to return this base map, whatever base map I have over here. 204 00:14:09,260 --> 00:14:10,710 So I have to simply return it. 205 00:14:11,030 --> 00:14:16,610 So now I have to just execute the sale and now I have to simply call this function here. 206 00:14:16,610 --> 00:14:22,130 I'm going to say I have to call this function what exactly my data from, which is exactly my idea. 207 00:14:22,190 --> 00:14:27,330 And let's say I just need my own analysis for that Saturday. 208 00:14:27,530 --> 00:14:30,320 So here I have to just past Saturday. 209 00:14:30,320 --> 00:14:37,130 And if you are going to execute it, you will get this type of amazing result from your huge chunk of 210 00:14:37,130 --> 00:14:38,150 data next year. 211 00:14:38,170 --> 00:14:40,040 I have to just zoom in this. 212 00:14:40,040 --> 00:14:41,750 Let me again zoom in it. 213 00:14:41,990 --> 00:14:45,000 Let me again zoom in it and you will observe. 214 00:14:45,020 --> 00:14:54,320 You can clearly observe is still your Mad Hatter is still your huge bright spot for your Saturday as 215 00:14:54,320 --> 00:14:54,560 well. 216 00:14:54,860 --> 00:14:58,880 But it's still there is some modification you will observe from my. 217 00:14:59,690 --> 00:15:06,170 One and in this one, yeah, you can definitely see this difference, so I hope you will love this session 218 00:15:06,170 --> 00:15:13,490 very much and how I have to meet all the analysts, how exactly I have performed is analysis on data. 219 00:15:14,060 --> 00:15:15,470 I hope you will love it very much. 220 00:15:15,590 --> 00:15:16,230 Thank you. 221 00:15:16,500 --> 00:15:18,350 How nice to keep learning. 222 00:15:18,350 --> 00:15:19,100 Keep growing. 223 00:15:19,310 --> 00:15:20,150 Keep practicing.