Master Python through building real-world applications (Part 2)

You must load data and extract relevance data to plot your markers..Here, we have added the data of volcanoes in the United States..You will find the data here.First, we load data with help of Pandas, which is a commonly used data manipulation library..Refer this page to learn the basics of pandas..The data file includes columns such as the name of the volcano, where it is, elevation, latitude, and longitude..We need latitude and longitude to plot markers and to display a popup, we are going to need elevation..Therefore, we’ll extract it and store it into our variables..Run a for loop and there it is, all the markers with just 2 lines of code.Step 4 — Add Markers from DataStep 5 — Colors (not by Jason Derulo)You’ve added all the markers, but they all are in the same color which doesn’t tell much of a story..So, let’s group them by elevation <1000, between 1000 and 3000, and > 3000 and set color to green, orange and red, respectively.You have to create a function using the simple if-else loops and call it in place of defining a color.Step 5 — ColorsStep 6 — Change IconsLet’s admit that the current icon might appear good but it’s not the best..It’s big and feels like we are creating the map in the ’90s..So let’s change them..I hope this is self-explanatory.Step 6 — Change IconsNow it looks good.. More details

Leave a Reply